From d91c1422a9d0b96172fb13da5a179688b590d125 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 7 Nov 2012 15:19:20 +0100 Subject: 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 (cherry picked from qt/c309d424f45dc0e7b62fbbbabf20dbfe355f48a7) Reviewed-by: aavit --- tests/auto/gui/image/qimagereader/images/trans.gif | Bin 0 -> 3234 bytes tests/auto/gui/image/qimagereader/tst_qimagereader.cpp | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 tests/auto/gui/image/qimagereader/images/trans.gif (limited to 'tests') diff --git a/tests/auto/gui/image/qimagereader/images/trans.gif b/tests/auto/gui/image/qimagereader/images/trans.gif new file mode 100644 index 0000000000..e26398af53 Binary files /dev/null and b/tests/auto/gui/image/qimagereader/images/trans.gif differ diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 8965cbd2fb..57aaeb965e 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -756,6 +756,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() -- cgit v1.2.3