Skip to content
Permalink
Browse files

support non-squared svg symbols

  • Loading branch information
jef-n committed Sep 17, 2012
1 parent 6589fbe commit 98a18ef832b514840e7d06999ba15ea8d5f5ccd3
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/core/symbology-ng/qgssvgcache.cpp
@@ -222,7 +222,17 @@ void QgsSvgCache::cacheImage( QgsSvgCacheEntry* entry )

QPainter p( image );
QSvgRenderer r( entry->svgContent );
r.render( &p );
if ( r.viewBox().width() == r.viewBox().height() )
{
r.render( &p );
}
else
{
QSize s( r.viewBox().size() );
s.scale( imageSize, imageSize, Qt::KeepAspectRatio );
QRect rect(( imageSize - s.width() ) / 2, ( imageSize - s.height() ) / 2, s.width(), s.height() );
r.render( &p, rect );
}

entry->image = image;
mTotalSize += ( image->width() * image->height() * 32 );

0 comments on commit 98a18ef

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