diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-05 13:31:10 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-05 13:42:21 (GMT) |
commit | d89d1eb47e69c2c2dc1121ef92fd08ef983e3e63 (patch) | |
tree | 3b09d34e6f0a0ae2418691df7bac3e1c8a6037cb /tests/auto | |
parent | 2a1eed4c718c8fa4a69351691aa466339d280126 (diff) | |
download | Qt-d89d1eb47e69c2c2dc1121ef92fd08ef983e3e63.zip Qt-d89d1eb47e69c2c2dc1121ef92fd08ef983e3e63.tar.gz Qt-d89d1eb47e69c2c2dc1121ef92fd08ef983e3e63.tar.bz2 |
Fixed bug where 0-opacity would cause images to be drawn fully opaque.
The bug appears in the raster paint engine and only in release mode as
the cause of the bug is in the MMX and SSE blend functions which are
disabled in debug. To prevent it simply we return early if we detect
that we have an opacity of 0.
Reviewed-by: Trond
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index c81bf67..87f9c13 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -225,6 +225,8 @@ private slots: void extendedBlendModes(); + void zeroOpacity(); + private: void fillData(); QColor baseColor( int k, int intensity=255 ); @@ -4150,5 +4152,21 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode(191, 191, 96, QPainter::CompositionMode_Exclusion)); } +void tst_QPainter::zeroOpacity() +{ + QImage source(1, 1, QImage::Format_ARGB32_Premultiplied); + source.fill(0xffffffff); + + QImage target(1, 1, QImage::Format_RGB32); + target.fill(0xff000000); + + QPainter p(&target); + p.setOpacity(0.0); + p.drawImage(0, 0, source); + p.end(); + + QCOMPARE(target.pixel(0, 0), 0xff000000); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |