summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpixmap
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-10-08 12:21:10 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-10-08 12:33:19 (GMT)
commit4d974ff0a748b22e668a4cb7ef38101122c85b3b (patch)
treef6e36f4780e747c023035c1ba0d472c08d0f5f2f /tests/auto/qpixmap
parent4cff91c66207b870e12365421e63cd978e162e64 (diff)
downloadQt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.zip
Qt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.tar.gz
Qt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.tar.bz2
Avoid in-place convertion of images with multiple references
The decoding from image reader was assuming the image reader do not keep the image internally. This is not true for the GIF plugins because the previous image can be used to compose the current image. This was causing crash on ARM because the 16 bits color depth causes the image memory to be reduce by half. When the plugin was accessing the memory, it assumes the images has not changed and is on 32 bits. This patch disable the in-place conversion if a detach is required. Regular conversion is the correct solution in this case, and it can also be made faster by converting while copying. Reviewed-by: Andreas Kling
Diffstat (limited to 'tests/auto/qpixmap')
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 8005ec5..24cbb21 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -179,6 +179,7 @@ private slots:
void fromImageReader_data();
void fromImageReader();
+ void fromImageReaderAnimatedGif_data();
void fromImageReaderAnimatedGif();
void preserveDepth();
@@ -1605,6 +1606,8 @@ void tst_QPixmap::fromImageReader_data()
QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif";
QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif";
QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg";
+ QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_with_alpha_animated.gif";
+ QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_no_alpha_animated.gif";
}
void tst_QPixmap::fromImageReader()
@@ -1621,14 +1624,22 @@ void tst_QPixmap::fromImageReader()
QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
}
+void tst_QPixmap::fromImageReaderAnimatedGif_data()
+{
+ QTest::addColumn<QString>("imagePath");
+ QTest::newRow("gif with alpha") << QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif");
+ QTest::newRow("gif without alpha") << QString::fromLatin1("/designer_indexed8_no_alpha_animated.gif");
+}
+
void tst_QPixmap::fromImageReaderAnimatedGif()
{
+ QFETCH(QString, imagePath);
#ifdef Q_OS_SYMBIAN
const QString prefix = QLatin1String(SRCDIR) + "loadFromData";
#else
const QString prefix = QLatin1String(SRCDIR) + "/loadFromData";
#endif
- const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif");
+ const QString path = prefix + imagePath;
QImageReader referenceReader(path);
QImageReader pixmapReader(path);