diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-03 12:16:39 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-03 12:22:30 (GMT) |
commit | 91f5c7314afdfd43c867266fc1bc418e0f70bac7 (patch) | |
tree | ecf73dfef25df6d4eda6d389623707b93a4b0a6e /tests | |
parent | d16b52d5346a3b652ad7507b24373c51fc0d530c (diff) | |
download | Qt-91f5c7314afdfd43c867266fc1bc418e0f70bac7.zip Qt-91f5c7314afdfd43c867266fc1bc418e0f70bac7.tar.gz Qt-91f5c7314afdfd43c867266fc1bc418e0f70bac7.tar.bz2 |
Fixed raster bug causing fully clipped images to be partially blended.
The blend functions assume the width / height of the images being
blended to be greater than 0. A width of 0 caused the first iteration of
a duff's device memcpy (QT_MEMCPY_USHORT) to be executed, thus blending
8 pixels instead of none.
BT: yes
Task-number: 255014
Reviewed-by: Trond
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 87f9c13..8d6c9d2 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -215,6 +215,7 @@ private slots: void imageCoordinateLimit(); void imageBlending_data(); void imageBlending(); + void imageBlending_clipped(); void paintOnNullPixmap(); void checkCompositionMode(); @@ -3792,6 +3793,31 @@ void tst_QPainter::imageBlending() } } +void tst_QPainter::imageBlending_clipped() +{ + QImage src(20, 20, QImage::Format_RGB16); + QPainter p(&src); + p.fillRect(src.rect(), Qt::red); + p.end(); + + QImage dst(40, 20, QImage::Format_RGB16); + p.begin(&dst); + p.fillRect(dst.rect(), Qt::white); + p.end(); + + QImage expected = dst; + + p.begin(&dst); + p.setClipRect(QRect(23, 0, 20, 20)); + + // should be completely clipped + p.drawImage(QRectF(3, 0, 20, 20), src); + p.end(); + + // dst should be left unchanged + QCOMPARE(dst, expected); +} + void tst_QPainter::paintOnNullPixmap() { QPixmap pix(16, 16); |