mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Don't try to compose images before they have been initialized
This commit is contained in:
parent
7aa4fa090b
commit
8b9e4922fc
@ -257,7 +257,10 @@ void QgsMapRendererCustomPainterJob::doRender()
|
||||
layerTime.start();
|
||||
|
||||
if ( job.img )
|
||||
{
|
||||
job.img->fill( 0 );
|
||||
job.imageInitialized = true;
|
||||
}
|
||||
|
||||
job.renderer->render();
|
||||
|
||||
|
@ -462,6 +462,9 @@ QImage QgsMapRendererJob::composeImage( const QgsMapSettings &settings, const La
|
||||
if ( job.layer && job.layer->customProperty( QStringLiteral( "rendering/renderAboveLabels" ) ).toBool() )
|
||||
continue; // skip layer for now, it will be rendered after labels
|
||||
|
||||
if ( !job.imageInitialized )
|
||||
continue; // img not safe to compose
|
||||
|
||||
painter.setCompositionMode( job.blendMode );
|
||||
painter.setOpacity( job.opacity );
|
||||
|
||||
@ -488,6 +491,9 @@ QImage QgsMapRendererJob::composeImage( const QgsMapSettings &settings, const La
|
||||
if ( !job.layer || !job.layer->customProperty( QStringLiteral( "rendering/renderAboveLabels" ) ).toBool() )
|
||||
continue;
|
||||
|
||||
if ( !job.imageInitialized )
|
||||
continue; // img not safe to compose
|
||||
|
||||
painter.setCompositionMode( job.blendMode );
|
||||
painter.setOpacity( job.opacity );
|
||||
|
||||
|
@ -46,6 +46,8 @@ struct LayerRenderJob
|
||||
{
|
||||
QgsRenderContext context;
|
||||
QImage *img; // may be null if it is not necessary to draw to separate image (e.g. sequential rendering)
|
||||
//! True when img has been initialized (filled with transparent pixels) and is safe to compose
|
||||
bool imageInitialized = false;
|
||||
QgsMapLayerRenderer *renderer; // must be deleted
|
||||
QPainter::CompositionMode blendMode;
|
||||
double opacity;
|
||||
|
@ -244,7 +244,10 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob &job )
|
||||
return;
|
||||
|
||||
if ( job.img )
|
||||
{
|
||||
job.img->fill( 0 );
|
||||
job.imageInitialized = true;
|
||||
}
|
||||
|
||||
QTime t;
|
||||
t.start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user