@@ -53,7 +53,7 @@ void QgsRasterRenderer::startRasterRead( int bandNumber, QgsRasterViewPort* view
53
53
pInfo.nCols = viewPort->drawableAreaXDim * oversampling;
54
54
pInfo.nRows = viewPort->drawableAreaYDim * oversampling;
55
55
int totalMemoryUsage = pInfo.nCols * pInfo.nRows * mProvider ->dataTypeSize ( bandNumber );
56
- int parts = totalMemoryUsage / 100000000 + 1 ;
56
+ int parts = totalMemoryUsage / 100000000 /* 10000 */ + 1 ;
57
57
pInfo.nPartsPerDimension = sqrt ( parts );
58
58
pInfo.nColsPerPart = pInfo.nCols / pInfo.nPartsPerDimension ;
59
59
pInfo.nRowsPerPart = pInfo.nRows / pInfo.nPartsPerDimension ;
@@ -97,10 +97,10 @@ bool QgsRasterRenderer::readNextRasterPart( int bandNumber, QgsRasterViewPort* v
97
97
98
98
// get subrectangle
99
99
QgsRectangle viewPortExtent = viewPort->mDrawnExtent ;
100
- double xmin = viewPortExtent.xMinimum () + pInfo.currentCol / pInfo.nCols * viewPortExtent.width ();
101
- double xmax = viewPortExtent.xMinimum () + ( pInfo.currentCol + nCols ) / pInfo.nCols * viewPortExtent.width ();
102
- double ymin = viewPortExtent.yMinimum () + ( pInfo.currentRow + nRows ) / pInfo.nRows * viewPortExtent.height ();
103
- double ymax = viewPortExtent.yMinimum () + pInfo.currentRow / pInfo.nRows * viewPortExtent.height ();
100
+ double xmin = viewPortExtent.xMinimum () + pInfo.currentCol / ( double ) pInfo.nCols * viewPortExtent.width ();
101
+ double xmax = viewPortExtent.xMinimum () + ( pInfo.currentCol + nCols ) / ( double ) pInfo.nCols * viewPortExtent.width ();
102
+ double ymin = viewPortExtent.yMaximum () - ( pInfo.currentRow + nRows ) / ( double ) pInfo.nRows * viewPortExtent.height ();
103
+ double ymax = viewPortExtent.yMaximum () - pInfo.currentRow / ( double ) pInfo.nRows * viewPortExtent.height ();
104
104
QgsRectangle blockRect ( xmin, ymin, xmax, ymax );
105
105
106
106
mProvider ->readBlock ( bandNumber, blockRect, nCols, nRows, viewPort->mSrcCRS , viewPort->mDestCRS , pInfo.data );
@@ -109,9 +109,11 @@ bool QgsRasterRenderer::readNextRasterPart( int bandNumber, QgsRasterViewPort* v
109
109
topLeftRow = pInfo.currentRow ;
110
110
111
111
pInfo.currentCol += nCols;
112
- pInfo.currentRow += nRows;
113
-
114
- if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow != pInfo.nRows ) // start new row
112
+ if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow + nRows == pInfo.nRows ) // end of raster
113
+ {
114
+ pInfo.currentRow = pInfo.nRows ;
115
+ }
116
+ else if ( pInfo.currentCol == pInfo.nCols ) // start new row
115
117
{
116
118
pInfo.currentCol = 0 ;
117
119
pInfo.currentRow += pInfo.nRowsPerPart ;
0 commit comments