Skip to content
Permalink
Browse files

Re-use RenderPreviewJob flag to for Prefetch

(cherry picked from commit 459bc53)
  • Loading branch information
elpaso authored and nyalldawson committed Jun 19, 2020
1 parent 95d0278 commit 9980d1a59d907d33f665ce90c7bffa4f70e211d9
@@ -304,7 +304,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;
@@ -42,7 +42,6 @@ to be rendered etc.
RenderPartialOutput,
RenderPreviewJob,
RenderBlocking,
Prefetch,
};
typedef QFlags<QgsRenderContext::Flag> Flags;

@@ -282,7 +282,6 @@ class CORE_EXPORT QgsMapSettings
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 )
@@ -179,7 +179,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() );
@@ -73,7 +73,6 @@ class CORE_EXPORT QgsRenderContext
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 )

@@ -241,7 +241,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 ) ) )
@@ -2444,10 +2444,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 9980d1a

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