diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-14 14:28:22 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-04-14 14:28:22 +0000 |
commit | 1dc0ad757eddbe5cdf1440a2ce24ad77304ac92f (patch) | |
tree | f7c9d8f736630f007bfdedc2021090013fd16112 /images/SkImageDecoder_libgif.cpp | |
parent | 04eef65090a9f261826ed82f4e3abc86d593d62a (diff) | |
download | src-1dc0ad757eddbe5cdf1440a2ce24ad77304ac92f.tar.gz |
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/src@155 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'images/SkImageDecoder_libgif.cpp')
-rw-r--r-- | images/SkImageDecoder_libgif.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/images/SkImageDecoder_libgif.cpp b/images/SkImageDecoder_libgif.cpp index ed8817ab..86ead1fa 100644 --- a/images/SkImageDecoder_libgif.cpp +++ b/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; } |