Skip to content

Commit 1144f3e

Browse files
committed
Fix rendering position in incremental rendering
1 parent 957f1ac commit 1144f3e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/gui/qgsmapcanvas.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ void QgsMapCanvas::rendererJobFinished()
726726

727727
p.end();
728728

729-
mMap->setContent( img, imageRect( img ) );
729+
mMap->setContent( img, imageRect( img, mJob->mapSettings() ) );
730730
}
731731

732732
// now we are in a slot called from mJob - do not delete it immediately
@@ -737,11 +737,11 @@ void QgsMapCanvas::rendererJobFinished()
737737
emit mapCanvasRefreshed();
738738
}
739739

740-
QgsRectangle QgsMapCanvas::imageRect( const QImage& img )
740+
QgsRectangle QgsMapCanvas::imageRect( const QImage& img, const QgsMapSettings& mapSettings )
741741
{
742-
// This is an hack to pass QgsMapCanvasItem::setRect what it
742+
// This is a hack to pass QgsMapCanvasItem::setRect what it
743743
// expects (encoding of position and size of the item)
744-
const QgsMapToPixel& m2p = mSettings.mapToPixel();
744+
const QgsMapToPixel& m2p = mapSettings.mapToPixel();
745745
QgsPoint topLeft = m2p.toMapPoint( 0, 0 );
746746
double res = m2p.mapUnitsPerPixel();
747747
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + img.width()*res, topLeft.y() - img.height()*res );
@@ -751,7 +751,7 @@ QgsRectangle QgsMapCanvas::imageRect( const QImage& img )
751751
void QgsMapCanvas::mapUpdateTimeout()
752752
{
753753
const QImage& img = mJob->renderedImage();
754-
mMap->setContent( img, imageRect( img ) );
754+
mMap->setContent( img, imageRect( img, mJob->mapSettings() ) );
755755
}
756756

757757
void QgsMapCanvas::stopRendering()

src/gui/qgsmapcanvas.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
674674

675675
QgsPreviewEffect* mPreviewEffect;
676676

677-
QgsRectangle imageRect( const QImage& img );
677+
QgsRectangle imageRect(const QImage& img , const QgsMapSettings& mapSettings );
678678

679679
QgsSnappingUtils* mSnappingUtils;
680680

0 commit comments

Comments
 (0)