mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Do not overwrite renderContext in QgsMapRendererJob::drawLabeling
Dedicated QgsRenderContext is already created and configured in prepareLabelingJob.
This commit is contained in:
parent
2c8acf136e
commit
948048cd4d
@ -183,6 +183,7 @@ emitted when asynchronous rendering is finished (or canceled).
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -295,12 +295,12 @@ void QgsMapRendererCustomPainterJob::doRender()
|
||||
mLabelJob.img->fill( 0 );
|
||||
painter.begin( mLabelJob.img );
|
||||
mLabelJob.context.setPainter( &painter );
|
||||
drawLabeling( mSettings, mLabelJob.context, mLabelingEngineV2.get(), &painter );
|
||||
drawLabeling( mLabelJob.context, mLabelingEngineV2.get(), &painter );
|
||||
painter.end();
|
||||
}
|
||||
else
|
||||
{
|
||||
drawLabeling( mSettings, mLabelJob.context, mLabelingEngineV2.get(), mPainter );
|
||||
drawLabeling( mLabelJob.context, mLabelingEngineV2.get(), mPainter );
|
||||
}
|
||||
|
||||
mLabelJob.complete = true;
|
||||
@ -318,8 +318,7 @@ void QgsMapRendererCustomPainterJob::doRender()
|
||||
QgsDebugMsgLevel( "Rendering completed in (seconds): " + QString( "%1" ).arg( renderTime.elapsed() / 1000.0 ), 2 );
|
||||
}
|
||||
|
||||
|
||||
void QgsMapRendererJob::drawLabeling( const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter )
|
||||
void QgsMapRendererJob::drawLabeling( QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter )
|
||||
{
|
||||
QgsDebugMsgLevel( QStringLiteral( "Draw labeling start" ), 5 );
|
||||
|
||||
@ -329,22 +328,22 @@ void QgsMapRendererJob::drawLabeling( const QgsMapSettings &settings, QgsRenderC
|
||||
// Reset the composition mode before rendering the labels
|
||||
painter->setCompositionMode( QPainter::CompositionMode_SourceOver );
|
||||
|
||||
// TODO: this is not ideal - we could override rendering stopped flag that has been set in meanwhile
|
||||
renderContext = QgsRenderContext::fromMapSettings( settings );
|
||||
renderContext.setPainter( painter );
|
||||
|
||||
if ( labelingEngine2 )
|
||||
{
|
||||
// set correct extent
|
||||
renderContext.setExtent( settings.visibleExtent() );
|
||||
renderContext.setCoordinateTransform( QgsCoordinateTransform() );
|
||||
|
||||
labelingEngine2->run( renderContext );
|
||||
}
|
||||
|
||||
QgsDebugMsg( QStringLiteral( "Draw labeling took (seconds): %1" ).arg( t.elapsed() / 1000. ) );
|
||||
}
|
||||
|
||||
void QgsMapRendererJob::drawLabeling( const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter )
|
||||
{
|
||||
Q_UNUSED( settings );
|
||||
|
||||
drawLabeling( renderContext, labelingEngine2, painter );
|
||||
}
|
||||
|
||||
bool QgsMapRendererJob::needTemporaryImage( QgsMapLayer *ml )
|
||||
{
|
||||
|
@ -286,8 +286,14 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
|
||||
*/
|
||||
void cleanupLabelJob( LabelRenderJob &job ) SIP_SKIP;
|
||||
|
||||
/**
|
||||
* \note not available in Python bindings
|
||||
* \deprecated Will be removed in QGIS 4.0
|
||||
*/
|
||||
Q_DECL_DEPRECATED static void drawLabeling( const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter ) SIP_SKIP;
|
||||
|
||||
//! \note not available in Python bindings
|
||||
static void drawLabeling( const QgsMapSettings &settings, QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter ) SIP_SKIP;
|
||||
static void drawLabeling( QgsRenderContext &renderContext, QgsLabelingEngine *labelingEngine2, QPainter *painter ) SIP_SKIP;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -297,7 +297,7 @@ void QgsMapRendererParallelJob::renderLabelsStatic( QgsMapRendererParallelJob *s
|
||||
// draw the labels!
|
||||
try
|
||||
{
|
||||
drawLabeling( self->mSettings, job.context, self->mLabelingEngineV2.get(), &painter );
|
||||
drawLabeling( job.context, self->mLabelingEngineV2.get(), &painter );
|
||||
}
|
||||
catch ( QgsException &e )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user