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>
bb10
Allan Sandfeld Jensen 2015-03-13 12:26:55 +01:00
parent 5d34bf9033
commit 5bee3ac1da
1 changed files with 4 additions and 1 deletions

View File

@ -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) {