@@ -53,7 +53,7 @@ void QgsRasterRenderer::startRasterRead( int bandNumber, QgsRasterViewPort* view
5353 pInfo.nCols = viewPort->drawableAreaXDim * oversampling;
5454 pInfo.nRows = viewPort->drawableAreaYDim * oversampling;
5555 int totalMemoryUsage = pInfo.nCols * pInfo.nRows * mProvider ->dataTypeSize ( bandNumber );
56- int parts = totalMemoryUsage / 100000000 + 1 ;
56+ int parts = totalMemoryUsage / 100000000 /* 10000 */ + 1 ;
5757 pInfo.nPartsPerDimension = sqrt ( parts );
5858 pInfo.nColsPerPart = pInfo.nCols / pInfo.nPartsPerDimension ;
5959 pInfo.nRowsPerPart = pInfo.nRows / pInfo.nPartsPerDimension ;
@@ -97,10 +97,10 @@ bool QgsRasterRenderer::readNextRasterPart( int bandNumber, QgsRasterViewPort* v
9797
9898 // get subrectangle
9999 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 ();
104104 QgsRectangle blockRect ( xmin, ymin, xmax, ymax );
105105
106106 mProvider ->readBlock ( bandNumber, blockRect, nCols, nRows, viewPort->mSrcCRS , viewPort->mDestCRS , pInfo.data );
@@ -109,9 +109,11 @@ bool QgsRasterRenderer::readNextRasterPart( int bandNumber, QgsRasterViewPort* v
109109 topLeftRow = pInfo.currentRow ;
110110
111111 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
115117 {
116118 pInfo.currentCol = 0 ;
117119 pInfo.currentRow += pInfo.nRowsPerPart ;
0 commit comments