Fix QImage::setPixelColor on RGBA64_Premultiplied
QColors were not premultiplied before being set. Pick-to: 6.0 5.15 5.12 Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
0a01396e60
commit
0c19e3f703
@ -2620,12 +2620,9 @@ void QImage::setPixelColor(int x, int y, const QColor &color)
|
||||
((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c);
|
||||
return;
|
||||
case Format_RGBX64:
|
||||
((QRgba64 *)s)[x] = color.rgba64();
|
||||
((QRgba64 *)s)[x].setAlpha(65535);
|
||||
return;
|
||||
case Format_RGBA64:
|
||||
case Format_RGBA64_Premultiplied:
|
||||
((QRgba64 *)s)[x] = color.rgba64();
|
||||
((QRgba64 *)s)[x] = c;
|
||||
return;
|
||||
default:
|
||||
setPixel(x, y, c.toArgb32());
|
||||
|
@ -3572,6 +3572,14 @@ void tst_QImage::pixelColor()
|
||||
// Try setting an invalid color.
|
||||
QTest::ignoreMessage(QtWarningMsg, "QImage::setPixelColor: color is invalid");
|
||||
argb32.setPixelColor(0, 0, QColor());
|
||||
|
||||
// Test correct premultiplied handling of RGBA64 as well
|
||||
QImage rgba64(1, 1, QImage::Format_RGBA64);
|
||||
QImage rgba64pm(1, 1, QImage::Format_RGBA64_Premultiplied);
|
||||
rgba64.setPixelColor(QPoint(0, 0), c);
|
||||
rgba64pm.setPixelColor(QPoint(0, 0), c);
|
||||
QCOMPARE(rgba64.pixelColor(QPoint(0, 0)), c);
|
||||
QCOMPARE(rgba64pm.pixelColor(QPoint(0, 0)), c);
|
||||
}
|
||||
|
||||
void tst_QImage::pixel()
|
||||
|
Loading…
Reference in New Issue
Block a user