diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-02 14:55:17 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-02 22:47:10 +0000 |
commit | 6ec7d7658d87132358e3c149f5e44e975748ae4b (patch) | |
tree | 0b2ac5e9293ba6468a3e334b424216937fef9ed8 /tests | |
parent | 72b57a5dfa49b4d4dd3b88cca8cc97e7283dcdf0 (diff) |
Fix rounding error in fetchTransformedBilinear
To calculate the real count we need to use the actual fixed point
increment and can not use the floating point value increment wass based
on since it might round differently.
Includes auto-test by Gabriel de Dietrich.
Task-number: QTBUG-50153
Change-Id: Ia973088f361c90370fa20bac14a4b8f373b5d234
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 1ed78fa0ef..8c72532122 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -305,6 +305,8 @@ private slots: void drawPolyline_data(); void drawPolyline(); + void QTBUG50153_drawImage_assert(); + private: void fillData(); void setPenColor(QPainter& p); @@ -5052,6 +5054,30 @@ void tst_QPainter::drawPolyline() QCOMPARE(images[0], images[1]); } +void tst_QPainter::QTBUG50153_drawImage_assert() +{ + QImage::Format formats[] = { + QImage::Format_RGB32, // fetchTransformedBilinearARGB32PM + QImage::Format_ARGB32 // fetchTransformedBilinear + }; + + for (unsigned i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) { + QImage image(3027, 2999, formats[i]); + + QImage backingStore(image.size(), QImage::Format_ARGB32); + QPainter backingStorePainter(&backingStore); + + QTransform transform; + transform.scale( 0.999987, 0.999987 ); + + backingStorePainter.setTransform(transform); + backingStorePainter.setRenderHint(QPainter::SmoothPixmapTransform, true); + backingStorePainter.drawImage(0, 0, image); + + // No crash, all fine + } +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |