From 09d2260b86e88edb181ea6e2a85f8b2603e3ba72 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Fri, 19 Oct 2018 09:53:42 -0400 Subject: [PATCH] rename physicalSize to deviceOutputSize --- python/core/auto_generated/qgsmapsettings.sip.in | 6 +++--- src/core/qgsmaprenderercustompainterjob.cpp | 2 +- src/core/qgsmaprendererjob.cpp | 6 +++--- src/core/qgsmaprenderersequentialjob.cpp | 2 +- src/core/qgsmapsettings.cpp | 2 +- src/core/qgsmapsettings.h | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/python/core/auto_generated/qgsmapsettings.sip.in b/python/core/auto_generated/qgsmapsettings.sip.in index ad402e61320..3e616adef0c 100644 --- a/python/core/auto_generated/qgsmapsettings.sip.in +++ b/python/core/auto_generated/qgsmapsettings.sip.in @@ -74,11 +74,11 @@ Sets the device pixel ratio .. versionadded:: 3.4 %End - QSize physicalSize() const; + QSize deviceOutputSize() const; %Docstring -Returns the physical size of the map canvas +Returns the device output size of the map canvas This is equivalent to the output size multiplicated -by the device pixel ratio +by the device pixel ratio. .. versionadded:: 3.4 %End diff --git a/src/core/qgsmaprenderercustompainterjob.cpp b/src/core/qgsmaprenderercustompainterjob.cpp index 30a4490f328..90f551b05a8 100644 --- a/src/core/qgsmaprenderercustompainterjob.cpp +++ b/src/core/qgsmaprenderercustompainterjob.cpp @@ -60,7 +60,7 @@ void QgsMapRendererCustomPainterJob::start() prepareTime.start(); // clear the background - mPainter->fillRect( 0, 0, mSettings.physicalSize().width(), mSettings.physicalSize().height(), mSettings.backgroundColor() ); + mPainter->fillRect( 0, 0, mSettings.deviceOutputSize().width(), mSettings.deviceOutputSize().height(), mSettings.backgroundColor() ); mPainter->setRenderHint( QPainter::Antialiasing, mSettings.testFlag( QgsMapSettings::Antialiasing ) ); diff --git a/src/core/qgsmaprendererjob.cpp b/src/core/qgsmaprendererjob.cpp index 81c649ee366..e7f00492566 100644 --- a/src/core/qgsmaprendererjob.cpp +++ b/src/core/qgsmaprendererjob.cpp @@ -325,7 +325,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter *painter, QgsLabelingEn if ( mCache || !painter || needTemporaryImage( ml ) ) { // Flattened image for drawing when a blending mode is set - QImage *mypFlattenedImage = new QImage( mSettings.physicalSize(), + QImage *mypFlattenedImage = new QImage( mSettings.deviceOutputSize(), mSettings.outputImageFormat() ); mypFlattenedImage->setDevicePixelRatio( mSettings.devicePixelRatio() ); if ( mypFlattenedImage->isNull() ) @@ -375,7 +375,7 @@ LabelRenderJob QgsMapRendererJob::prepareLabelingJob( QPainter *painter, QgsLabe { // Flattened image for drawing labels QImage *mypFlattenedImage = nullptr; - mypFlattenedImage = new QImage( mSettings.physicalSize(), + mypFlattenedImage = new QImage( mSettings.deviceOutputSize(), mSettings.outputImageFormat() ); mypFlattenedImage->setDevicePixelRatio( mSettings.devicePixelRatio() ); if ( mypFlattenedImage->isNull() ) @@ -448,7 +448,7 @@ void QgsMapRendererJob::cleanupLabelJob( LabelRenderJob &job ) QImage QgsMapRendererJob::composeImage( const QgsMapSettings &settings, const LayerRenderJobs &jobs, const LabelRenderJob &labelJob ) { - QImage image( settings.physicalSize(), settings.outputImageFormat() ); + QImage image( settings.deviceOutputSize(), settings.outputImageFormat() ); image.setDevicePixelRatio( settings.devicePixelRatio() ); image.fill( settings.backgroundColor().rgba() ); diff --git a/src/core/qgsmaprenderersequentialjob.cpp b/src/core/qgsmaprenderersequentialjob.cpp index 953e1deff12..f375680a3ed 100644 --- a/src/core/qgsmaprenderersequentialjob.cpp +++ b/src/core/qgsmaprenderersequentialjob.cpp @@ -25,7 +25,7 @@ QgsMapRendererSequentialJob::QgsMapRendererSequentialJob( const QgsMapSettings & { QgsDebugMsgLevel( QStringLiteral( "SEQUENTIAL construct" ), 5 ); - mImage = QImage( mSettings.physicalSize(), mSettings.outputImageFormat() ); + mImage = QImage( mSettings.deviceOutputSize(), mSettings.outputImageFormat() ); mImage.setDevicePixelRatio( mSettings.devicePixelRatio() ); mImage.setDotsPerMeterX( 1000 * settings.outputDpi() / 25.4 ); mImage.setDotsPerMeterY( 1000 * settings.outputDpi() / 25.4 ); diff --git a/src/core/qgsmapsettings.cpp b/src/core/qgsmapsettings.cpp index f215ed317d0..2bfaaec46d2 100644 --- a/src/core/qgsmapsettings.cpp +++ b/src/core/qgsmapsettings.cpp @@ -240,7 +240,7 @@ void QgsMapSettings::setDevicePixelRatio( int dpr ) mDevicePixelRatio = dpr; } -QSize QgsMapSettings::physicalSize() const +QSize QgsMapSettings::deviceOutputSize() const { return outputSize() * mDevicePixelRatio; } diff --git a/src/core/qgsmapsettings.h b/src/core/qgsmapsettings.h index 61b6bc3e59b..9d268511158 100644 --- a/src/core/qgsmapsettings.h +++ b/src/core/qgsmapsettings.h @@ -94,12 +94,12 @@ class CORE_EXPORT QgsMapSettings void setDevicePixelRatio( int dpr ); /** - * Returns the physical size of the map canvas + * Returns the device output size of the map canvas * This is equivalent to the output size multiplicated - * by the device pixel ratio + * by the device pixel ratio. * \since QGIS 3.4 */ - QSize physicalSize() const; + QSize deviceOutputSize() const; /** * Returns the rotation of the resulting map image, in degrees clockwise.