From 9781ca586618cc8ea055f54021e706824313d4f5 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 14 Apr 2009 14:28:22 +0000 Subject: add SkSfntUtils to parse some known truetype tables add comments and cleanup to count_tables in SkFontHost_tables.cpp fix transparency bug in gifs use (alpha+1) for blending in srcover mode, to ensure opaque results git-svn-id: http://skia.googlecode.com/svn/trunk@155 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/images/SkImageDecoder_libgif.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/images/SkImageDecoder_libgif.cpp') diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp index ed8817ab86..86ead1faff 100644 --- a/src/images/SkImageDecoder_libgif.cpp +++ b/src/images/SkImageDecoder_libgif.cpp @@ -171,6 +171,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, int width, height; GifRecordType recType; GifByteType *extData; + int transpIndex = -1; // -1 means we don't have it (yet) do { if (DGifGetRecordType(gif, &recType) == GIF_ERROR) { @@ -226,7 +227,7 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, cmap->Colors[index].Green, cmap->Colors[index].Blue); - int transpIndex = find_transpIndex(temp_save, colorCount); + transpIndex = find_transpIndex(temp_save, colorCount); if (transpIndex < 0) ctable->setFlags(ctable->getFlags() | SkColorTable::kColorsAreOpaque_Flag); else @@ -257,12 +258,18 @@ bool SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, if ((desc.Top | desc.Left) > 0 || innerWidth < width || innerHeight < height) { - uint8_t fill = (uint8_t)gif->SBackGroundColor; + int fill; + if (transpIndex >= 0) { + fill = transpIndex; + } else { + fill = gif->SBackGroundColor; + } // check for valid fill index/color - if (fill >= (unsigned)colorCount) { + if (static_cast(fill) >= + static_cast(colorCount)) { fill = 0; } - memset(scanline, gif->SBackGroundColor, bm->getSize()); + memset(scanline, fill, bm->getSize()); // bump our starting address scanline += desc.Top * rowBytes + desc.Left; } -- cgit v1.2.3