Commit d661d4a1 authored by Christian Stenger's avatar Christian Stenger

Utils: Fix maskToColorAndAlpha()

This produced wrong disabled icons on some platforms.

Change-Id: I3a80ac7f5e1fd5027d665e5791df802c78e2113a
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@theqtcompany.com>
parent 2c6d7519
......@@ -50,9 +50,9 @@ static QPixmap maskToColorAndAlpha(const QPixmap &mask, const QColor &color)
QRgb *bitsStart = reinterpret_cast<QRgb*>(result.bits());
const QRgb *bitsEnd = bitsStart + result.width() * result.height();
const QRgb tint = color.rgb() & 0x00ffffff;
const qreal alpha = color.alphaF();
const QRgb alpha = QRgb(color.alpha());
for (QRgb *pixel = bitsStart; pixel < bitsEnd; ++pixel) {
QRgb pixelAlpha = ~(*pixel & 0xff) * alpha;
QRgb pixelAlpha = (((~*pixel) & 0xff) * alpha) >> 8;
*pixel = (pixelAlpha << 24) | tint;
}
return QPixmap::fromImage(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment