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

Unified Diff: src/images/SkMovie_gif.cpp

Issue 1184083002: SkGIFMovie: Fix corrupted background color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change commit message Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkMovie_gif.cpp
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index 40e5520def6ef0d23d95b06b60798b1be68a7395..380aca499a40fbf36e9d3a9a45d1b26f1a1ad88a 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -35,6 +35,7 @@ private:
int fCurrIndex;
int fLastDrawIndex;
SkBitmap fBackup;
+ SkColor fPaintingColor;
};
static int Decode(GifFileType* fileType, GifByteType* out, int size) {
@@ -59,6 +60,7 @@ SkGIFMovie::SkGIFMovie(SkStream* stream)
}
fCurrIndex = -1;
fLastDrawIndex = -1;
+ fPaintingColor = SkPackARGB32(0, 0, 0, 0);
}
SkGIFMovie::~SkGIFMovie()
@@ -395,7 +397,6 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
bgColor = SkColorSetARGB(0xFF, col.Red, col.Green, col.Blue);
}
- static SkColor paintingColor = SkPackARGB32(0, 0, 0, 0);
// draw each frames - not intelligent way
for (int i = startIndex; i <= lastIndex; i++) {
const SavedImage* cur = &fGIF->SavedImages[i];
@@ -404,17 +405,17 @@ bool SkGIFMovie::onGetBitmap(SkBitmap* bm)
int disposal;
getTransparencyAndDisposalMethod(cur, &trans, &disposal);
if (!trans && gif->SColorMap != NULL) {
- paintingColor = bgColor;
+ fPaintingColor = bgColor;
} else {
- paintingColor = SkColorSetARGB(0, 0, 0, 0);
+ fPaintingColor = SkColorSetARGB(0, 0, 0, 0);
}
- bm->eraseColor(paintingColor);
- fBackup.eraseColor(paintingColor);
+ bm->eraseColor(fPaintingColor);
+ fBackup.eraseColor(fPaintingColor);
} else {
// Dispose previous frame before move to next frame.
const SavedImage* prev = &fGIF->SavedImages[i-1];
- disposeFrameIfNeeded(bm, prev, cur, &fBackup, paintingColor);
+ disposeFrameIfNeeded(bm, prev, cur, &fBackup, fPaintingColor);
}
// Draw frame
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698