From 5bee3ac1da725489f760810d69289a96ebf9ea75 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 13 Mar 2015 12:26:55 +0100 Subject: Do not colorizing images to invalid premultiplied colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some combinations the fusion style colorizeImage method would generate invalid colors causing odd colors in the end result. Task-number: QTBUG-41515 Change-Id: Ib16049be1f3e93ae4976524df2827076eac7d94f Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qfusionstyle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/widgets/styles/qfusionstyle.cpp') diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 0cc1211cc0..62097a2cee 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -209,7 +209,10 @@ static QPixmap colorizedImage(const QString &fileName, const QColor &color, int unsigned char green = gray + qt_div_255(sourceGreen * colorDiff); unsigned char blue = gray + qt_div_255(sourceBlue * colorDiff); unsigned char alpha = qt_div_255(qAlpha(col) * qAlpha(source)); - data[x] = qRgba(red, green, blue, alpha); + data[x] = qRgba(std::min(alpha, red), + std::min(alpha, green), + std::min(alpha, blue), + alpha); } } if (rotation != 0) { -- cgit v1.2.3