summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2016-11-18 16:33:12 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-12-03 13:24:36 +0000
commite3b6f6d16577c74433de1ca9e15402cdf285abca (patch)
treeff6a3f155111c51502bf38b0881452afe6cc61fd /tests
parent5cc1265c340656b02f3bd2fccbadd29a21aa8704 (diff)
Fix blending of RGB32 on RGB32 with partial opacity
The alpha channel of an RGB32 image was not properly ignored when doing blending with partial opacity. Now the alpha value is properly ignored, which is both more correct and faster. This also makes SSE2 and AVX2 implementations match NEON which was already doing the right thing (though had dead code for doing it wrong). Change-Id: I4613b8d70ed8c2e36ced10baaa7a4a55bd36a940 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 254ab1f8ad..c729b2f94c 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -300,6 +300,8 @@ private slots:
void QTBUG56252();
+ void blendNullRGB32();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5139,6 +5141,24 @@ void tst_QPainter::QTBUG56252()
// If no crash or illegal memory read, all is fine
}
+void tst_QPainter::blendNullRGB32()
+{
+ quint32 data[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ QImage nullImage((const uchar*)data, 16, 1, QImage::Format_RGB32);
+ QImage image(16, 1, QImage::Format_RGB32);
+ image.fill(Qt::white);
+
+ QPainter paint(&image);
+ paint.setCompositionMode(QPainter::CompositionMode_Source);
+ paint.setOpacity(0.5);
+ paint.drawImage(0, 0, nullImage);
+ paint.end();
+
+ for (int i=0; i < image.width(); ++i)
+ QVERIFY(image.pixel(i,0) != 0xffffffff);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"