summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qfusionstyle.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-03-13 12:26:55 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-03-16 22:43:02 +0000
commit5bee3ac1da725489f760810d69289a96ebf9ea75 (patch)
treead1ff073bc897fe9a8241d759c18bcb79b16dd30 /src/widgets/styles/qfusionstyle.cpp
parent5d34bf9033531264cfaa87c0259d331a2f07443b (diff)
Do not colorizing images to invalid premultiplied colors
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 <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: Jens Bache-Wiig <jensbw@gmail.com>
Diffstat (limited to 'src/widgets/styles/qfusionstyle.cpp')
-rw-r--r--src/widgets/styles/qfusionstyle.cpp5
1 files changed, 4 insertions, 1 deletions
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) {