From 268cf203a80fe3b51327c9baa70b9dccccb6d36c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Sep 2020 23:01:22 +0200 Subject: [PATCH] [libcalamaresui] Remove unused parameter/functionality - nothing in Calamares uses the tinting, and it triggers some deprecation warnings, so just remove it. --- src/libcalamaresui/utils/ImageRegistry.cpp | 29 ++++++---------------- src/libcalamaresui/utils/ImageRegistry.h | 8 +++--- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index ffc65300e..86a9cf212 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -34,9 +34,9 @@ ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode ) 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, const QSize& size, CalamaresUtils::ImageMode mode, - qreal opacity, - QColor tint ) + qreal opacity ) { Q_ASSERT( !( 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 ); - const qint64 ck = cacheKey( size, opacity, tint ); + const qint64 ck = cacheKey( size, opacity ); if ( subsubcache.contains( ck ) ) { return subsubcache.value( ck ); @@ -85,19 +84,6 @@ ImageRegistry::pixmap( const QString& image, svgRenderer.render( &pixPainter ); 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; } 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; @@ -140,8 +126,7 @@ ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, - const QPixmap& pixmap, - QColor tint ) + const QPixmap& pixmap ) { QHash< qint64, QPixmap > subsubcache; 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 ); s_cache.insert( image, subcache ); } diff --git a/src/libcalamaresui/utils/ImageRegistry.h b/src/libcalamaresui/utils/ImageRegistry.h index 80bc25ff6..87c73823f 100644 --- a/src/libcalamaresui/utils/ImageRegistry.h +++ b/src/libcalamaresui/utils/ImageRegistry.h @@ -25,17 +25,15 @@ public: QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, - qreal opacity = 1.0, - QColor tint = QColor( 0, 0, 0, 0 ) ); + qreal opacity = 1.0 ); private: - qint64 cacheKey( const QSize& size, qreal opacity, QColor tint ); + qint64 cacheKey( const QSize& size, qreal opacity ); void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, - const QPixmap& pixmap, - QColor tint ); + const QPixmap& pixmap ); }; #endif // IMAGE_REGISTRY_H