Skip to content

Commit 70a0a6e

Browse files
committedFeb 17, 2015
Fix #12151 - fix cached composer map image when zoomed in a lot
The map was being rendered with wrong parameters when width or height exceeded 5000 pixels.
1 parent b3a4ace commit 70a0a6e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed
 

‎src/core/composer/qgscomposermap.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,19 @@ void QgsComposerMap::cache( void )
270270
int w = widthMM * horizontalVScaleFactor;
271271
int h = heightMM * horizontalVScaleFactor;
272272

273-
if ( w > 5000 ) //limit size of image for better performance
273+
// limit size of image for better performance
274+
if ( w > 5000 || h > 5000 )
274275
{
275-
w = 5000;
276-
}
277-
278-
if ( h > 5000 )
279-
{
280-
h = 5000;
276+
if ( w > h )
277+
{
278+
w = 5000;
279+
h = w * heightMM / widthMM;
280+
}
281+
else
282+
{
283+
h = 5000;
284+
w = h * widthMM / heightMM;
285+
}
281286
}
282287

283288
mCacheImage = QImage( w, h, QImage::Format_ARGB32 );

0 commit comments

Comments
 (0)
Please sign in to comment.