Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1901 from m-kuhn/fixrendering
Fix rendering position in incremental rendering
  • Loading branch information
m-kuhn committed Feb 16, 2015
2 parents b3bd32f + 1144f3e commit 96732bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -726,7 +726,7 @@ void QgsMapCanvas::rendererJobFinished()

p.end();

mMap->setContent( img, imageRect( img ) );
mMap->setContent( img, imageRect( img, mJob->mapSettings() ) );
}

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

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

void QgsMapCanvas::stopRendering()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Expand Up @@ -674,7 +674,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

QgsPreviewEffect* mPreviewEffect;

QgsRectangle imageRect( const QImage& img );
QgsRectangle imageRect(const QImage& img , const QgsMapSettings& mapSettings );

QgsSnappingUtils* mSnappingUtils;

Expand Down

0 comments on commit 96732bb

Please sign in to comment.