@@ -354,24 +354,22 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )
354
354
// we could use floating point for raster devices as well, but respecting the
355
355
// output device grid should make it more effective as the resampling is done in
356
356
// the provider anyway
357
- if ( true )
358
- {
359
- myRasterViewPort->mTopLeftPoint .setX ( floor ( myRasterViewPort->mTopLeftPoint .x () ) );
360
- myRasterViewPort->mTopLeftPoint .setY ( floor ( myRasterViewPort->mTopLeftPoint .y () ) );
361
- myRasterViewPort->mBottomRightPoint .setX ( ceil ( myRasterViewPort->mBottomRightPoint .x () ) );
362
- myRasterViewPort->mBottomRightPoint .setY ( ceil ( myRasterViewPort->mBottomRightPoint .y () ) );
363
- // recalc myRasterExtent to aligned values
364
- myRasterExtent.set (
365
- theQgsMapToPixel.toMapCoordinatesF ( myRasterViewPort->mTopLeftPoint .x (),
366
- myRasterViewPort->mBottomRightPoint .y () ),
367
- theQgsMapToPixel.toMapCoordinatesF ( myRasterViewPort->mBottomRightPoint .x (),
368
- myRasterViewPort->mTopLeftPoint .y () )
369
- );
357
+ myRasterViewPort->mTopLeftPoint .setX ( floor ( myRasterViewPort->mTopLeftPoint .x () ) );
358
+ myRasterViewPort->mTopLeftPoint .setY ( floor ( myRasterViewPort->mTopLeftPoint .y () ) );
359
+ myRasterViewPort->mBottomRightPoint .setX ( ceil ( myRasterViewPort->mBottomRightPoint .x () ) );
360
+ myRasterViewPort->mBottomRightPoint .setY ( ceil ( myRasterViewPort->mBottomRightPoint .y () ) );
361
+ // recalc myRasterExtent to aligned values
362
+ myRasterExtent.set (
363
+ theQgsMapToPixel.toMapCoordinatesF ( myRasterViewPort->mTopLeftPoint .x (),
364
+ myRasterViewPort->mBottomRightPoint .y () ),
365
+ theQgsMapToPixel.toMapCoordinatesF ( myRasterViewPort->mBottomRightPoint .x (),
366
+ myRasterViewPort->mTopLeftPoint .y () )
367
+ );
370
368
371
- }
369
+ // raster viewport top left / bottom right are already rounded to int
370
+ myRasterViewPort->mWidth = static_cast <int >( myRasterViewPort->mBottomRightPoint .x () - myRasterViewPort->mTopLeftPoint .x () );
371
+ myRasterViewPort->mHeight = static_cast <int >( myRasterViewPort->mBottomRightPoint .y () - myRasterViewPort->mTopLeftPoint .y () );
372
372
373
- myRasterViewPort->mWidth = static_cast <int >( qAbs (( myRasterExtent.width () / theQgsMapToPixel.mapUnitsPerPixel () ) ) );
374
- myRasterViewPort->mHeight = static_cast <int >( qAbs (( myRasterExtent.height () / theQgsMapToPixel.mapUnitsPerPixel () ) ) );
375
373
376
374
// the drawable area can start to get very very large when you get down displaying 2x2 or smaller, this is becasue
377
375
// theQgsMapToPixel.mapUnitsPerPixel() is less then 1,
0 commit comments