Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1018)

Unified Diff: src/codec/SkCodec_libgif.cpp

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix windows errors Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec_libgif.cpp
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 3e78f233222c3294d363faac8b78dbf92a580d82..5f1bec0dde302791eaa78c4ffa4894b818fbe374 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -382,14 +382,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++) {
@@ -407,9 +399,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 = SkColorTypeBytesPerPixel(dstColorType);
@@ -436,13 +427,11 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
for (int32_t y = 0; y < innerHeight; y++) {
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 *
- get_output_row_interlaced(y, innerHeight));
- swizzler->swizzle(dstRow, buffer.get());
- }
+ memset(buffer.get(), fillIndex, innerWidth);
+ for (; y < innerHeight; y++) {
+ void* dstRow = SkTAddOffset<void>(dst, dstRowBytes *
+ get_output_row_interlaced(y, innerHeight));
+ swizzler->swizzle(dstRow, buffer.get());
}
return gif_error(SkStringPrintf(
"Could not decode line %d of %d.\n",
@@ -457,10 +446,8 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
void* dstRow = dst;
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);
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkCodec_libpng.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698