summaryrefslogtreecommitdiff
path: root/tests/auto/qimagereader
diff options
context:
space:
mode:
authoraavit <eirik.aavitsland@digia.com>2012-11-07 15:19:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-08 11:35:04 +0100
commitc309d424f45dc0e7b62fbbbabf20dbfe355f48a7 (patch)
treea5b0e6405652b4e2f2af98a9a90934c26ad91409 /tests/auto/qimagereader
parent5ec6e2aca2950634d39195cc858bf062a2e2618d (diff)
downloadqt4-tools-c309d424f45dc0e7b62fbbbabf20dbfe355f48a7.tar.gz
Fix GIF image decoding: do not zero transparent pixels
For the special transparent color index, the decoder would skip writing anything out (thus leaving the pixels at 0 rgba value). Although correct for later frames, for the initial frame this would loose the color information for such pixels (which one otherwise could have made visible e.g. by converting then image to an alpha-less image format). Change-Id: I316cefce8f21797feedebfbf98296ad84eaa4b99 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'tests/auto/qimagereader')
-rw-r--r--tests/auto/qimagereader/images/trans.gifbin0 -> 3234 bytes
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp9
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qimagereader/images/trans.gif b/tests/auto/qimagereader/images/trans.gif
new file mode 100644
index 0000000000..e26398af53
--- /dev/null
+++ b/tests/auto/qimagereader/images/trans.gif
Binary files differ
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 7a2acee792..14ce74bf61 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -855,6 +855,15 @@ void tst_QImageReader::gifHandlerBugs()
QVERIFY(io.canRead());
QCOMPARE(io.loopCount(), -1);
}
+
+ // Check that pixels with the transparent color are transparent but not zeroed
+ {
+ QImageReader io(prefix + "trans.gif");
+ QVERIFY(io.canRead());
+ QImage im = io.read();
+ QCOMPARE(im.pixel(0,0), qRgba(0x3f, 0xff, 0x7f, 0x00));
+ QCOMPARE(im.pixel(10,10), qRgba(0x3f, 0xff, 0x7f, 0x00));
+ }
}
void tst_QImageReader::animatedGif()