diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-09 18:19:56 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-09 18:19:56 (GMT) |
commit | ea65e98e89967044446e95f3e0943631fb10bf39 (patch) | |
tree | b4bf965912eddccf444e2c934ec211f7e2e29f08 | |
parent | 20a3f5a4748f04d8a584040256755af7f97e870d (diff) | |
parent | 1c5da7207a21cc44a4a08d291c290ffcd9b958fd (diff) | |
download | Qt-ea65e98e89967044446e95f3e0943631fb10bf39.zip Qt-ea65e98e89967044446e95f3e0943631fb10bf39.tar.gz Qt-ea65e98e89967044446e95f3e0943631fb10bf39.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Prevent crash in OpenGL engine when scaling images / pixmaps.
-rw-r--r-- | src/gui/image/qimage.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qimage/tst_qimage.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qpixmap/tst_qpixmap.cpp | 8 |
4 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 441bdb1..c867984 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4377,6 +4377,8 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf QSize newSize = size(); newSize.scale(s, aspectMode); + newSize.rwidth() = qMax(newSize.width(), 1); + newSize.rheight() = qMax(newSize.height(), 1); if (newSize == size()) return *this; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 1a83318..ed1b0f0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1479,6 +1479,8 @@ QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Tran QSize newSize = size(); newSize.scale(s, aspectMode); + newSize.rwidth() = qMax(newSize.width(), 1); + newSize.rheight() = qMax(newSize.height(), 1); if (newSize == size()) return *this; diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 558dfaa..6bb08b0 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -144,6 +144,7 @@ private slots: void rgbSwapped(); void deepCopyWhenPaintingActive(); + void scaled_QTBUG19157(); }; tst_QImage::tst_QImage() @@ -1902,5 +1903,12 @@ void tst_QImage::deepCopyWhenPaintingActive() QVERIFY(copy != image); } +void tst_QImage::scaled_QTBUG19157() +{ + QImage foo(5000, 1, QImage::Format_RGB32); + foo = foo.scaled(1024, 1024, Qt::KeepAspectRatio); + QVERIFY(!foo.isNull()); +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 0b2f527..12d31e3 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -196,6 +196,7 @@ private slots: #endif void drawPixmapWhilePainterOpen(); + void scaled_QTBUG19157(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1942,5 +1943,12 @@ void tst_QPixmap::drawPixmapWhilePainterOpen() } } +void tst_QPixmap::scaled_QTBUG19157() +{ + QPixmap foo(5000, 1); + foo = foo.scaled(1024, 1024, Qt::KeepAspectRatio); + QVERIFY(!foo.isNull()); +} + QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" |