|
|
|
@ -34,17 +34,16 @@ ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qint64
|
|
|
|
|
ImageRegistry::cacheKey( const QSize& size, qreal opacity )
|
|
|
|
|
ImageRegistry::cacheKey( const QSize& size )
|
|
|
|
|
{
|
|
|
|
|
return size.width() * 100 + size.height() * 10 + static_cast< qint64 >( opacity * 100.0 );
|
|
|
|
|
return size.width() * 100 + size.height() * 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPixmap
|
|
|
|
|
ImageRegistry::pixmap( const QString& image,
|
|
|
|
|
const QSize& size,
|
|
|
|
|
CalamaresUtils::ImageMode mode,
|
|
|
|
|
qreal opacity )
|
|
|
|
|
CalamaresUtils::ImageMode mode )
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) );
|
|
|
|
|
if ( size.width() < 0 || size.height() < 0 )
|
|
|
|
@ -63,7 +62,7 @@ ImageRegistry::pixmap( const QString& image,
|
|
|
|
|
{
|
|
|
|
|
subsubcache = subcache.value( mode );
|
|
|
|
|
|
|
|
|
|
const qint64 ck = cacheKey( size, opacity );
|
|
|
|
|
const qint64 ck = cacheKey( size );
|
|
|
|
|
if ( subsubcache.contains( ck ) )
|
|
|
|
|
{
|
|
|
|
|
return subsubcache.value( ck );
|
|
|
|
@ -80,7 +79,6 @@ ImageRegistry::pixmap( const QString& image,
|
|
|
|
|
p.fill( Qt::transparent );
|
|
|
|
|
|
|
|
|
|
QPainter pixPainter( &p );
|
|
|
|
|
pixPainter.setOpacity( opacity );
|
|
|
|
|
svgRenderer.render( &pixPainter );
|
|
|
|
|
pixPainter.end();
|
|
|
|
|
|
|
|
|
@ -114,7 +112,7 @@ ImageRegistry::pixmap( const QString& image,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
putInCache( image, size, mode, opacity, pixmap );
|
|
|
|
|
putInCache( image, size, mode, pixmap );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pixmap;
|
|
|
|
@ -125,7 +123,6 @@ void
|
|
|
|
|
ImageRegistry::putInCache( const QString& image,
|
|
|
|
|
const QSize& size,
|
|
|
|
|
CalamaresUtils::ImageMode mode,
|
|
|
|
|
qreal opacity,
|
|
|
|
|
const QPixmap& pixmap )
|
|
|
|
|
{
|
|
|
|
|
QHash< qint64, QPixmap > subsubcache;
|
|
|
|
@ -140,7 +137,7 @@ ImageRegistry::putInCache( const QString& image,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subsubcache.insert( cacheKey( size, opacity ), pixmap );
|
|
|
|
|
subsubcache.insert( cacheKey( size ), pixmap );
|
|
|
|
|
subcache.insert( mode, subsubcache );
|
|
|
|
|
s_cache.insert( image, subcache );
|
|
|
|
|
}
|
|
|
|
|