Skip to content

Commit

Permalink
Fix #9698 (magnified SVG symbols with data-defined rotation)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Mar 4, 2014
1 parent 9774abd commit 86ea4bf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@

#include <cmath>

Q_GUI_EXPORT extern int qt_defaultDpiX();
Q_GUI_EXPORT extern int qt_defaultDpiY();

static void _fixQPictureDPI( QPainter* p )
{
// QPicture makes an assumption that we drawing to it with system DPI.
// Then when being drawn, it scales the painter. The following call
// negates the effect. There is no way of setting QPicture's DPI.
// See QTBUG-20361
p->scale(( double )qt_defaultDpiX() / p->device()->logicalDpiX(),
( double )qt_defaultDpiY() / p->device()->logicalDpiY() );
}

//////

QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle, QgsSymbolV2::ScaleMethod scaleMethod )
Expand Down Expand Up @@ -1189,7 +1202,10 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re

if ( pct.width() > 1 )
{
p->save();
_fixQPictureDPI( p );
p->drawPicture( 0, 0, pct );
p->restore();
hwRatio = ( double )pct.height() / ( double )pct.width();
}
}
Expand Down

0 comments on commit 86ea4bf

Please sign in to comment.