mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 08:21:54 +02:00
* ImageRegistry supports rendering SVGs now.
This commit is contained in:
parent
93e3d6644c
commit
d9c8ef9273
@ -17,6 +17,9 @@
|
||||
|
||||
#include "ImageRegistry.h"
|
||||
|
||||
#include <QSvgRenderer>
|
||||
#include <QPainter>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
static QHash< QString, QHash< int, QHash< int, QPixmap > > > s_cache;
|
||||
@ -58,7 +61,21 @@ ImageRegistry::getFromCache( const QString& image, const QSize& size, TomahawkUt
|
||||
}
|
||||
|
||||
// Image not found in cache. Let's load it.
|
||||
QPixmap pixmap( image );
|
||||
QPixmap pixmap;
|
||||
if ( image.toLower().endsWith( ".svg" ) )
|
||||
{
|
||||
QSvgRenderer svgRenderer( image );
|
||||
QPixmap p( size.isNull() ? svgRenderer.defaultSize() : size );
|
||||
p.fill( Qt::transparent );
|
||||
|
||||
QPainter pixPainter( &p );
|
||||
svgRenderer.render( &pixPainter );
|
||||
|
||||
pixmap = p;
|
||||
}
|
||||
else
|
||||
pixmap = QPixmap( image );
|
||||
|
||||
if ( !pixmap.isNull() )
|
||||
{
|
||||
switch ( mode )
|
||||
|
Loading…
x
Reference in New Issue
Block a user