Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix rendering of cached simple marker images on hidpi map displays
  • Loading branch information
nyalldawson committed May 17, 2023
1 parent 74849da commit 1d70004
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/symbology/qgsmarkersymbollayer.cpp
Expand Up @@ -1178,7 +1178,11 @@ bool QgsSimpleMarkerSymbolLayer::prepareCache( QgsSymbolRenderContext &context )
return false;
}

mCache = QImage( QSize( imageSize, imageSize ), QImage::Format_ARGB32_Premultiplied );
mCache = QImage( QSize( imageSize * context.renderContext().devicePixelRatio(),
imageSize * context.renderContext().devicePixelRatio() ), QImage::Format_ARGB32_Premultiplied );
mCache.setDevicePixelRatio( context.renderContext().devicePixelRatio() );
mCache.setDotsPerMeterX( std::round( context.renderContext().scaleFactor() * 1000 ) );
mCache.setDotsPerMeterY( std::round( context.renderContext().scaleFactor() * 1000 ) );
mCache.fill( 0 );

const bool needsBrush = shapeIsFilled( mShape );
Expand Down Expand Up @@ -1338,7 +1342,7 @@ void QgsSimpleMarkerSymbolLayer::renderPoint( QPointF point, QgsSymbolRenderCont
if ( mUsingCache && qgsDoubleNear( mCachedOpacity, context.opacity() ) )
{
const QImage &img = context.selected() ? mSelCache : mCache;
const double s = img.width();
const double s = img.width() / img.devicePixelRatioF();

bool hasDataDefinedSize = false;
const double scaledSize = calculateSize( context, hasDataDefinedSize );
Expand Down

0 comments on commit 1d70004

Please sign in to comment.