Skip to content
Permalink
Browse files

rename physicalSize to deviceOutputSize

  • Loading branch information
3nids committed Oct 19, 2018
1 parent 924e375 commit 09d2260b86e88edb181ea6e2a85f8b2603e3ba72
@@ -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
@@ -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 ) );

@@ -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() );

@@ -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 );
@@ -240,7 +240,7 @@ void QgsMapSettings::setDevicePixelRatio( int dpr )
mDevicePixelRatio = dpr;
}

QSize QgsMapSettings::physicalSize() const
QSize QgsMapSettings::deviceOutputSize() const
{
return outputSize() * mDevicePixelRatio;
}
@@ -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.

0 comments on commit 09d2260

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