Skip to content
Permalink
Browse files

Fill image with 0 in rendering thread (#3722)

Calling QImage::fill( 0 ) on rendering start takes about 40% of the
time required for setting up a new job.
Since this is done on the main thread, the interface feels more
snappy the quicker the setup process is completed.
  • Loading branch information
m-kuhn committed Nov 5, 2016
1 parent 5984b21 commit 022e2285225329d10b5d7791a71ce1a34126fbce
@@ -244,6 +244,9 @@ void QgsMapRendererCustomPainterJob::doRender()
QTime layerTime;
layerTime.start();

if ( job.img )
job.img->fill( 0 );

job.renderer->render();

job.renderingTime = layerTime.elapsed();
@@ -286,7 +286,6 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsLabelingEn
layerJobs.removeLast();
continue;
}
mypFlattenedImage->fill( 0 );

job.img = mypFlattenedImage;
QPainter* mypPainter = new QPainter( job.img );
@@ -215,6 +215,9 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob& job )
if ( job.cached )
return;

if ( job.img )
job.img->fill( 0 );

QTime t;
t.start();
QgsDebugMsgLevel( QString( "job %1 start (layer %2)" ).arg( reinterpret_cast< ulong >( &job ), 0, 16 ).arg( job.layerId ), 2 );

0 comments on commit 022e228

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