Skip to content

Commit

Permalink
Merge pull request #776 from Oslandia/issue7926
Browse files Browse the repository at this point in the history
- fix #7926
  • Loading branch information
NathanW2 committed Jul 30, 2013
2 parents a13cdf8 + eeaa867 commit 812d1ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/composer/qgscomposition.cpp
Expand Up @@ -2025,6 +2025,7 @@ QImage QgsComposition::printPageAsRaster( int page )
image.fill( 0 );
QPainter imagePainter( &image );
renderPage( &imagePainter, page );
if ( !imagePainter.isActive() ) return QImage();
}
return image;
}
Expand Down
14 changes: 14 additions & 0 deletions src/core/qgsmaprenderer.cpp
Expand Up @@ -463,6 +463,13 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
QgsDebugMsg( "Caching enabled but layer redraw forced by extent change or empty cache" );
QImage * mypImage = new QImage( mRenderContext.painter()->device()->width(),
mRenderContext.painter()->device()->height(), QImage::Format_ARGB32 );
if ( mypImage->isNull() )
{
QgsDebugMsg( "insufficient memory for image " + QString::number(mRenderContext.painter()->device()->width()) + "x" + QString::number(mRenderContext.painter()->device()->height()) );
emit drawError( ml );
painter->end(); // drawError is not caught by anyone, so we end painting to notify caller
return;
}
mypImage->fill( 0 );
ml->setCacheImage( mypImage ); //no need to delete the old one, maplayer does it for you
QPainter * mypPainter = new QPainter( ml->cacheImage() );
Expand Down Expand Up @@ -501,6 +508,13 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
flattenedLayer = true;
mypFlattenedImage = new QImage( mRenderContext.painter()->device()->width(),
mRenderContext.painter()->device()->height(), QImage::Format_ARGB32 );
if ( mypFlattenedImage->isNull() )
{
QgsDebugMsg( "insufficient memory for image " + QString::number(mRenderContext.painter()->device()->width()) + "x" + QString::number(mRenderContext.painter()->device()->height()) );
emit drawError( ml );
painter->end(); // drawError is not caught by anyone, so we end painting to notify caller
return;
}
mypFlattenedImage->fill( 0 );
QPainter * mypPainter = new QPainter( mypFlattenedImage );
if ( mySettings.value( "/qgis/enable_anti_aliasing", true ).toBool() )
Expand Down

0 comments on commit 812d1ed

Please sign in to comment.