diff options
author | 2009-04-14 14:28:22 +0000 | |
---|---|---|
committer | 2009-04-14 14:28:22 +0000 | |
commit | 9781ca586618cc8ea055f54021e706824313d4f5 (patch) | |
tree | 2d6d4dffba13e109d846a049d21c0239f4acbf8f /src/images/SkImageDecoder_libgif.cpp | |
parent | fc3ac327d8e041e11049d7f0dfc7f491590cda75 (diff) |
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
Diffstat (limited to 'src/images/SkImageDecoder_libgif.cpp')
-rw-r--r-- | src/images/SkImageDecoder_libgif.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
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<unsigned>(fill) >= + static_cast<unsigned>(colorCount)) { fill = 0; } - memset(scanline, gif->SBackGroundColor, bm->getSize()); + memset(scanline, fill, bm->getSize()); // bump our starting address scanline += desc.Top * rowBytes + desc.Left; } |