Skip to content

Commit

Permalink
Fix handling of pixel ratio for raster image decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jul 3, 2024
1 parent f6e28b2 commit fe4eb9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/parametizedimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void ParametizedImage::paint( QPainter *painter )
const double drawnHeight = std::ceil( sourceRatio >= itemRatio ? mSourceSize.height() * size().width() / mSourceSize.width() : size().height() );
const double devicePixelRatio = window()->screen()->devicePixelRatio();
QImage sourceImage = QgsApplication::instance()->imageCache()->pathAsImage( mSource, QSize( drawnWidth * devicePixelRatio, drawnHeight * devicePixelRatio ), true, 1, fitsInCache, true );
painter->drawImage( ( size().width() - drawnWidth ) / 2, ( size().height() - drawnHeight ) / 2, sourceImage );
painter->drawImage( QRectF( ( size().width() - drawnWidth ) / 2, ( size().height() - drawnHeight ) / 2, drawnWidth, drawnHeight ), sourceImage );
}
else
{
Expand Down

0 comments on commit fe4eb9a

Please sign in to comment.