Skip to content

Commit

Permalink
Store cached layer render results based on whether each individual
Browse files Browse the repository at this point in the history
job finished, not whether the whole map render finished

This means that we will store cached results of layers which are
faster to render and had already completed while a slower layer
was still rendering and then the map render job was canceled.

In this case we've already got a nice complete render of some layers
ready for caching, so it's wasteful to discard these results and
then redraw from scratch next time.
  • Loading branch information
nyalldawson committed Jan 28, 2021
1 parent 2657da8 commit ab94b20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgsmaprendererjob.cpp
Expand Up @@ -682,7 +682,7 @@ void QgsMapRendererJob::cleanupJobs( LayerRenderJobs &jobs )
delete job.context.painter();
job.context.setPainter( nullptr );

if ( mCache && !job.cached && !job.context.renderingStopped() && job.layer )
if ( mCache && !job.cached && job.completed && job.layer )
{
QgsDebugMsgLevel( QStringLiteral( "caching image for %1" ).arg( job.layerId ), 2 );
mCache->setCacheImage( job.layerId, *job.img, QList< QgsMapLayer * >() << job.layer );
Expand Down

0 comments on commit ab94b20

Please sign in to comment.