Skip to content
Permalink
Browse files

Re-use RenderPreviewJob flag to for Prefetch

  • Loading branch information
elpaso committed May 13, 2020
1 parent f029b1f commit 459bc533272e8ec2339010af2966a5a240922ab3
@@ -344,7 +344,6 @@ Gets color that is used for drawing of selected vector features
RenderPartialOutput,
RenderPreviewJob,
RenderBlocking,
Prefetch,
// TODO: ignore scale-based visibility (overview)
};
typedef QFlags<QgsMapSettings::Flag> Flags;
@@ -43,7 +43,6 @@ to be rendered etc.
RenderPartialOutput,
RenderPreviewJob,
RenderBlocking,
Prefetch,
};
typedef QFlags<QgsRenderContext::Flag> Flags;

@@ -310,7 +310,6 @@ class CORE_EXPORT QgsMapSettings : public QgsTemporalRangeObject
RenderPartialOutput = 0x200, //!< Whether to make extra effort to update map image with partially rendered layers (better for interactive map canvas). Added in QGIS 3.0
RenderPreviewJob = 0x400, //!< Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering
RenderBlocking = 0x800, //!< Render and load remote sources in the same thread to ensure rendering remote sources (svg and images). WARNING: this flag must NEVER be used from GUI based applications (like the main QGIS application) or crashes will result. Only for use in external scripts or QGIS server.
Prefetch = 0x1000, //!< The render is a prefetched image, not visible in the current view extent
// TODO: ignore scale-based visibility (overview)
};
Q_DECLARE_FLAGS( Flags, Flag )
@@ -187,7 +187,6 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings &mapSet
ctx.setFlag( RenderPartialOutput, mapSettings.testFlag( QgsMapSettings::RenderPartialOutput ) );
ctx.setFlag( RenderPreviewJob, mapSettings.testFlag( QgsMapSettings::RenderPreviewJob ) );
ctx.setFlag( RenderBlocking, mapSettings.testFlag( QgsMapSettings::RenderBlocking ) );
ctx.setFlag( Prefetch, mapSettings.testFlag( QgsMapSettings::Prefetch ) );
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
ctx.setRendererScale( mapSettings.scale() );
ctx.setExpressionContext( mapSettings.expressionContext() );
@@ -79,7 +79,6 @@ class CORE_EXPORT QgsRenderContext : public QgsTemporalRangeObject
RenderPartialOutput = 0x100, //!< Whether to make extra effort to update map image with partially rendered layers (better for interactive map canvas). Added in QGIS 3.0
RenderPreviewJob = 0x200, //!< Render is a 'canvas preview' render, and shortcuts should be taken to ensure fast rendering
RenderBlocking = 0x400, //!< Render and load remote sources in the same thread to ensure rendering remote sources (svg and images). WARNING: this flag must NEVER be used from GUI based applications (like the main QGIS application) or crashes will result. Only for use in external scripts or QGIS server.
Prefetch = 0x800, //!< The render is a prefetched image, not visible in the current view extent
};
Q_DECLARE_FLAGS( Flags, Flag )

@@ -266,7 +266,7 @@ QgsRasterLayerRenderer::~QgsRasterLayerRenderer()
bool QgsRasterLayerRenderer::render()
{
// Skip rendering of out of view tiles (xyz)
if ( !mRasterViewPort || ( mLayer && renderContext()->testFlag( QgsRenderContext::Flag::Prefetch ) &&
if ( !mRasterViewPort || ( mLayer && renderContext()->testFlag( QgsRenderContext::Flag::RenderPreviewJob ) &&
mLayer->dataProvider() &&
!( mLayer->dataProvider()->capabilities() &
QgsRasterInterface::Capability::Prefetch ) ) )
@@ -2559,10 +2559,6 @@ void QgsMapCanvas::startPreviewJob( int number )
jobSettings.setFlag( QgsMapSettings::DrawLabeling, false );
jobSettings.setFlag( QgsMapSettings::RenderPreviewJob, true );

// Tell the renderer that this image is out of current view extent
if ( number != 4 )
jobSettings.setFlag( QgsMapSettings::Flag::Prefetch );

// truncate preview layers to fast layers
const QList<QgsMapLayer *> layers = jobSettings.layers();
QList< QgsMapLayer * > previewLayers;

0 comments on commit 459bc53

Please sign in to comment.
You can’t perform that action at this time.