Skip to content
Permalink
Browse files

Include job preparation time in layer rendering timer

This prevents layers which are slow to prepare from rendering
in map preview jobs
  • Loading branch information
nyalldawson committed Feb 9, 2018
1 parent 2e5d538 commit 50a881360a83cc79a11c3694b6925182e1de3c6a
@@ -264,7 +264,7 @@ void QgsMapRendererCustomPainterJob::doRender()

job.renderer->render();

job.renderingTime = layerTime.elapsed();
job.renderingTime += layerTime.elapsed();
}

if ( job.img )
@@ -343,7 +343,10 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter *painter, QgsLabelingEn
if ( hasStyleOverride )
ml->styleManager()->setOverrideStyle( mSettings.layerStyleOverrides().value( ml->id() ) );

QTime layerTime;
layerTime.start();
job.renderer = ml->createMapRenderer( job.context );
job.renderingTime = layerTime.elapsed(); // include job preparation time in layer rendering time

if ( hasStyleOverride )
ml->styleManager()->restoreOverrideStyle();
@@ -269,7 +269,7 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob &job )
{
QgsDebugMsg( "Caught unhandled unknown exception" );
}
job.renderingTime = t.elapsed();
job.renderingTime += t.elapsed();
QgsDebugMsgLevel( QString( "job %1 end [%2 ms] (layer %3)" ).arg( reinterpret_cast< quint64 >( &job ), 0, 16 ).arg( job.renderingTime ).arg( job.layer ? job.layer->id() : QString() ), 2 );
}

0 comments on commit 50a8813

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