Skip to content

Commit

Permalink
rename physicalSize to deviceOutputSize
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 19, 2018
1 parent 924e375 commit 09d2260
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions python/core/auto_generated/qgsmapsettings.sip.in
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderercustompainterjob.cpp
Expand Up @@ -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 ) );

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmaprendererjob.cpp
Expand Up @@ -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() )
Expand Down Expand Up @@ -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() )
Expand Down Expand Up @@ -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() );

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderersequentialjob.cpp
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmapsettings.cpp
Expand Up @@ -240,7 +240,7 @@ void QgsMapSettings::setDevicePixelRatio( int dpr )
mDevicePixelRatio = dpr;
}

QSize QgsMapSettings::physicalSize() const
QSize QgsMapSettings::deviceOutputSize() const
{
return outputSize() * mDevicePixelRatio;
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsmapsettings.h
Expand Up @@ -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.
Expand Down

0 comments on commit 09d2260

Please sign in to comment.