1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Keep aspect ratio for image requests with width or height being 0.

This commit is contained in:
Christian Muehlhaeuser
2014-11-20 16:15:59 +01:00
parent 78eb0c0f1d
commit c1b2929a64

View File

@@ -116,7 +116,12 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
} }
if ( !size.isNull() && pixmap.size() != size ) if ( !size.isNull() && pixmap.size() != size )
pixmap = pixmap.scaled( size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); {
Qt::AspectRatioMode aspect = Qt::IgnoreAspectRatio;
if ( size.height() == 0 || size.width() == 0 )
aspect = Qt::KeepAspectRatio;
pixmap = pixmap.scaled( size, aspect, Qt::SmoothTransformation );
}
putInCache( image, size, mode, opacity, pixmap, tint ); putInCache( image, size, mode, opacity, pixmap, tint );
} }