Skip to content

Commit

Permalink
When labelling job takes a long time to render, don't clear the
Browse files Browse the repository at this point in the history
map canvas between the finished layer render state and final
state

Avoids map canvas blanking out during a redraw while the labeling
stage is underway, and instead correctly uses the nice layer
cache preview instead.
  • Loading branch information
nyalldawson committed Feb 9, 2021
1 parent c661359 commit 1beb1bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/qgsmaprendererparalleljob.cpp
Expand Up @@ -209,7 +209,12 @@ QgsLabelingResults *QgsMapRendererParallelJob::takeLabelingResults()

QImage QgsMapRendererParallelJob::renderedImage()
{
if ( mStatus == RenderingLayers )
// if status == Idle we are either waiting for the render to start, OR have finished the render completely.
// We can differentiate between those states by checking whether mFinalImage is null -- at the "waiting for
// render to start" state mFinalImage has not yet been created.
const bool jobIsComplete = mStatus == Idle && !mFinalImage.isNull();

if ( !jobIsComplete )
return composeImage( mSettings, mLayerJobs, mLabelJob, mCache );
else
return mFinalImage; // when rendering labels or idle
Expand Down

0 comments on commit 1beb1bd

Please sign in to comment.