Fix QImage::setPixelColor on RGBA64_Premultiplied
QColors were not premultiplied before being set. Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 0c19e3f703a7c3fd59e6db8a9d4ac7091674b552) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
539a16a69f
commit
6f125dcf1a
@ -2620,12 +2620,9 @@ void QImage::setPixelColor(int x, int y, const QColor &color)
|
|||||||
((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c);
|
((uint *)s)[x] = qConvertRgb64ToRgb30<PixelOrderRGB>(c);
|
||||||
return;
|
return;
|
||||||
case Format_RGBX64:
|
case Format_RGBX64:
|
||||||
((QRgba64 *)s)[x] = color.rgba64();
|
|
||||||
((QRgba64 *)s)[x].setAlpha(65535);
|
|
||||||
return;
|
|
||||||
case Format_RGBA64:
|
case Format_RGBA64:
|
||||||
case Format_RGBA64_Premultiplied:
|
case Format_RGBA64_Premultiplied:
|
||||||
((QRgba64 *)s)[x] = color.rgba64();
|
((QRgba64 *)s)[x] = c;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
setPixel(x, y, c.toArgb32());
|
setPixel(x, y, c.toArgb32());
|
||||||
|
@ -3572,6 +3572,14 @@ void tst_QImage::pixelColor()
|
|||||||
// Try setting an invalid color.
|
// Try setting an invalid color.
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QImage::setPixelColor: color is invalid");
|
QTest::ignoreMessage(QtWarningMsg, "QImage::setPixelColor: color is invalid");
|
||||||
argb32.setPixelColor(0, 0, QColor());
|
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()
|
void tst_QImage::pixel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user