[libcalamaresui] Remove unused parameter/functionality

- nothing in Calamares uses the tinting, and it triggers some
  deprecation warnings, so just remove it.
This commit is contained in:
Adriaan de Groot 2020-09-22 23:01:22 +02:00
parent 2878c474c5
commit 268cf203a8
2 changed files with 10 additions and 27 deletions

View File

@ -34,9 +34,9 @@ ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode )
qint64 qint64
ImageRegistry::cacheKey( const QSize& size, qreal opacity, QColor tint ) ImageRegistry::cacheKey( const QSize& size, qreal opacity )
{ {
return size.width() * 100 + size.height() * 10 + static_cast< qint64 >( opacity * 100.0 ) + tint.value(); return size.width() * 100 + size.height() * 10 + static_cast< qint64 >( opacity * 100.0 );
} }
@ -44,8 +44,7 @@ QPixmap
ImageRegistry::pixmap( const QString& image, ImageRegistry::pixmap( const QString& image,
const QSize& size, const QSize& size,
CalamaresUtils::ImageMode mode, CalamaresUtils::ImageMode mode,
qreal opacity, qreal opacity )
QColor tint )
{ {
Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) ); Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) );
if ( size.width() < 0 || size.height() < 0 ) if ( size.width() < 0 || size.height() < 0 )
@ -64,7 +63,7 @@ ImageRegistry::pixmap( const QString& image,
{ {
subsubcache = subcache.value( mode ); subsubcache = subcache.value( mode );
const qint64 ck = cacheKey( size, opacity, tint ); const qint64 ck = cacheKey( size, opacity );
if ( subsubcache.contains( ck ) ) if ( subsubcache.contains( ck ) )
{ {
return subsubcache.value( ck ); return subsubcache.value( ck );
@ -85,19 +84,6 @@ ImageRegistry::pixmap( const QString& image,
svgRenderer.render( &pixPainter ); svgRenderer.render( &pixPainter );
pixPainter.end(); pixPainter.end();
if ( tint.alpha() > 0 )
{
QImage resultImage( p.size(), QImage::Format_ARGB32_Premultiplied );
QPainter painter( &resultImage );
painter.drawPixmap( 0, 0, p );
painter.setCompositionMode( QPainter::CompositionMode_Screen );
painter.fillRect( resultImage.rect(), tint );
painter.end();
resultImage.setAlphaChannel( p.toImage().alphaChannel() );
p = QPixmap::fromImage( resultImage );
}
pixmap = p; pixmap = p;
} }
else else
@ -128,7 +114,7 @@ ImageRegistry::pixmap( const QString& image,
} }
} }
putInCache( image, size, mode, opacity, pixmap, tint ); putInCache( image, size, mode, opacity, pixmap );
} }
return pixmap; return pixmap;
@ -140,8 +126,7 @@ ImageRegistry::putInCache( const QString& image,
const QSize& size, const QSize& size,
CalamaresUtils::ImageMode mode, CalamaresUtils::ImageMode mode,
qreal opacity, qreal opacity,
const QPixmap& pixmap, const QPixmap& pixmap )
QColor tint )
{ {
QHash< qint64, QPixmap > subsubcache; QHash< qint64, QPixmap > subsubcache;
QHash< int, QHash< qint64, QPixmap > > subcache; QHash< int, QHash< qint64, QPixmap > > subcache;
@ -155,7 +140,7 @@ ImageRegistry::putInCache( const QString& image,
} }
} }
subsubcache.insert( cacheKey( size, opacity, tint ), pixmap ); subsubcache.insert( cacheKey( size, opacity ), pixmap );
subcache.insert( mode, subsubcache ); subcache.insert( mode, subsubcache );
s_cache.insert( image, subcache ); s_cache.insert( image, subcache );
} }

View File

@ -25,17 +25,15 @@ public:
QPixmap pixmap( const QString& image, QPixmap pixmap( const QString& image,
const QSize& size, const QSize& size,
CalamaresUtils::ImageMode mode = CalamaresUtils::Original, CalamaresUtils::ImageMode mode = CalamaresUtils::Original,
qreal opacity = 1.0, qreal opacity = 1.0 );
QColor tint = QColor( 0, 0, 0, 0 ) );
private: private:
qint64 cacheKey( const QSize& size, qreal opacity, QColor tint ); qint64 cacheKey( const QSize& size, qreal opacity );
void putInCache( const QString& image, void putInCache( const QString& image,
const QSize& size, const QSize& size,
CalamaresUtils::ImageMode mode, CalamaresUtils::ImageMode mode,
qreal opacity, qreal opacity,
const QPixmap& pixmap, const QPixmap& pixmap );
QColor tint );
}; };
#endif // IMAGE_REGISTRY_H #endif // IMAGE_REGISTRY_H