Protect point and line pattern symbol layer from eating too much memory

This commit is contained in:
Marco Hugentobler 2013-02-21 11:18:10 +01:00
parent eea57cfc2a
commit b54c75cef7

View File

@ -747,6 +747,13 @@ void QgsLinePatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& conte
int dx = 0;
int dy = 0;
if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}
QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );
QPainter p( &patternImage );
@ -1049,6 +1056,13 @@ void QgsPointPatternFillSymbolLayer::startRender( QgsSymbolV2RenderContext& cont
double width = context.outputPixelSize( mDistanceX ) * 2.0;
double height = context.outputPixelSize( mDistanceY ) * 2.0;
if ( width > 10000 || height > 10000 ) //protect symbol layer from eating too much memory
{
QImage img;
mBrush.setTextureImage( img );
return;
}
QImage patternImage( width, height, QImage::Format_ARGB32 );
patternImage.fill( 0 );