| Index: src/codec/SkCodec_libgif.cpp
|
| diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
|
| index c18e06ddd1996918753c8c577cc12cb52af6e016..49248a0434b65377ea97058e4dd5bf8dea81e4b8 100644
|
| --- a/src/codec/SkCodec_libgif.cpp
|
| +++ b/src/codec/SkCodec_libgif.cpp
|
| @@ -379,14 +379,6 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| }
|
| }
|
|
|
| - // Check if we can skip filling the background of the image. We
|
| - // may be able to if the memory is zero initialized.
|
| - bool skipBackground =
|
| - ((kN32_SkColorType == dstColorType && colorTable[fillIndex] == 0) ||
|
| - (kIndex_8_SkColorType == dstColorType && fillIndex == 0)) &&
|
| - kYes_ZeroInitialized == zeroInit;
|
| -
|
| -
|
| // Fill in the color table for indices greater than color count.
|
| // This allows for predictable, safe behavior.
|
| for (uint32_t i = colorCount; i < maxColors; i++) {
|
| @@ -405,10 +397,8 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| // FIXME: This may not be the behavior that we want for
|
| // animated gifs where we draw on top of the
|
| // previous frame.
|
| - if (!skipBackground) {
|
| - SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height,
|
| - fillIndex, colorTable);
|
| - }
|
| + SkSwizzler::Fill(dst, dstInfo, dstRowBytes, height,
|
| + fillIndex, colorTable, zeroInit);
|
|
|
| // Modify the dst pointer
|
| const int32_t dstBytesPerPixel =
|
| @@ -442,13 +432,11 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| if (GIF_ERROR == DGifGetLine(fGif, buffer.get(),
|
| innerWidth)) {
|
| // Recover from error by filling remainder of image
|
| - if (!skipBackground) {
|
| - memset(buffer.get(), fillIndex, innerWidth);
|
| - for (; y < innerHeight; y++) {
|
| - void* dstRow = SkTAddOffset<void>(dst,
|
| - dstRowBytes * iter.nextY());
|
| - swizzler->swizzle(dstRow, buffer.get());
|
| - }
|
| + memset(buffer.get(), fillIndex, innerWidth);
|
| + for (; y < innerHeight; y++) {
|
| + void* dstRow = SkTAddOffset<void>(dst,
|
| + dstRowBytes * iter.nextY());
|
| + swizzler->swizzle(dstRow, buffer.get());
|
| }
|
| return gif_error(SkStringPrintf(
|
| "Could not decode line %d of %d.\n",
|
| @@ -464,10 +452,9 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| for (int32_t y = 0; y < innerHeight; y++) {
|
| if (GIF_ERROR == DGifGetLine(fGif, buffer.get(),
|
| innerWidth)) {
|
| - if (!skipBackground) {
|
| - SkSwizzler::Fill(dstRow, dstInfo, dstRowBytes,
|
| - innerHeight - y, fillIndex, colorTable);
|
| - }
|
| + SkSwizzler::Fill(dstRow, dstInfo, dstRowBytes,
|
| + innerHeight - y, fillIndex, colorTable,
|
| + zeroInit);
|
| return gif_error(SkStringPrintf(
|
| "Could not decode line %d of %d.\n",
|
| y, height - 1).c_str(), kIncompleteInput);
|
|
|