From 2f7068aec9906168b3c142b5057e098114376cc9 Mon Sep 17 00:00:00 2001 From: scroggo Date: Mon, 31 Oct 2016 04:45:10 -0700 Subject: Treat a GIF with no color table as transparent When checking to see whether a GIF has transparency to determine its alpha type, treat an empty color table as having alpha, since we will draw it as a transparent image. (This is a separate bug from skbug.com/5883, but the image I used to verify that bug was drawn to 565 as black. The fix is to not support 565 in that case, by changing its recommended alpha type.) BUG=skia:5883 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2461813002 Review-Url: https://codereview.chromium.org/2461813002 --- third_party/gif/SkGifImageReader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'third_party/gif') diff --git a/third_party/gif/SkGifImageReader.cpp b/third_party/gif/SkGifImageReader.cpp index eeaee68c1d..bbf5f9a2f0 100644 --- a/third_party/gif/SkGifImageReader.cpp +++ b/third_party/gif/SkGifImageReader.cpp @@ -737,8 +737,10 @@ bool SkGifImageReader::parse(SkGifImageReader::SkGIFParseQuery query) bool hasTransparentPixel; if (m_frames.size() == 0) { // We did not see a Graphics Control Extension, so no transparent - // pixel was specified. - hasTransparentPixel = false; + // pixel was specified. But if there is no color table, this frame is + // still transparent. + hasTransparentPixel = !isLocalColormapDefined + && m_globalColorMap.numColors() == 0; } else { // This means we did see a Graphics Control Extension, which specifies // the transparent pixel -- cgit v1.2.3