Skip to content

Commit

Permalink
[layouts] Use smooth pixmap transform when rendering picture items
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Nov 9, 2021
1 parent a559212 commit e35790d
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/layout/qgslayoutitempicture.cpp
Expand Up @@ -92,6 +92,10 @@ void QgsLayoutItemPicture::draw( QgsLayoutItemRenderContext &context )
// painter is scaled to dots, so scale back to layout units
painter->scale( context.renderContext().scaleFactor(), context.renderContext().scaleFactor() );

const bool prevSmoothTransform = painter->testRenderHint( QPainter::RenderHint::SmoothPixmapTransform );
if ( mLayout->renderContext().testFlag( QgsLayoutRenderContext::FlagAntialiasing ) )
painter->setRenderHint( QPainter::RenderHint::SmoothPixmapTransform, true );

//picture resizing
if ( mMode != FormatUnknown )
{
Expand Down Expand Up @@ -203,8 +207,8 @@ void QgsLayoutItemPicture::draw( QgsLayoutItemRenderContext &context )
{
painter->drawImage( QRectF( 0, 0, boundRectWidthMM, boundRectHeightMM ), mImage, imageRect );
}

}
painter->setRenderHint( QPainter::RenderHint::SmoothPixmapTransform, prevSmoothTransform );
}

QSizeF QgsLayoutItemPicture::applyItemSizeConstraint( const QSizeF targetSize )
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e35790d

Please sign in to comment.