Skip to content
Permalink
Browse files

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 96732bb91cc4d78e92c9b83c07e5eb37a0943b2e
Showing with 6 additions and 6 deletions.
  1. +5 −5 src/gui/qgsmapcanvas.cpp
  2. +1 −1 src/gui/qgsmapcanvas.h
@@ -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
@@ -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 );
@@ -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()
@@ -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;

0 comments on commit 96732bb

Please sign in to comment.
You can’t perform that action at this time.