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

Unified Diff: src/codec/SkCodec_libgif.cpp

Issue 1288483002: Consolidate SkCodec functions for handling rewind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: src/codec/SkCodec_libgif.cpp
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index cf935777d18ef2ad6fd388ee80055166a7042e7d..2e348cc856a20eedf72afe6fe773092cb838613c 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -234,6 +234,17 @@ static bool conversion_possible(const SkImageInfo& dst,
}
}
+bool SkGifCodec::onRewind() {
+ GifFileType* gifOut = NULL;
+ if (!ReadHeader(this->stream(), NULL, &gifOut)) {
+ return false;
+ }
+
+ SkASSERT(NULL != gifOut);
+ fGif.reset(gifOut);
+ return true;
+}
+
/*
* Initiates the gif decode
*/
@@ -243,17 +254,8 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo,
SkPMColor* inputColorPtr,
int* inputColorCount) {
// Rewind if necessary
- SkCodec::RewindState rewindState = this->rewindIfNeeded();
- if (rewindState == kCouldNotRewind_RewindState) {
+ if (!this->rewindIfNeeded()) {
return kCouldNotRewind;
- } else if (rewindState == kRewound_RewindState) {
- GifFileType* gifOut = NULL;
- if (!ReadHeader(this->stream(), NULL, &gifOut)) {
- return kCouldNotRewind;
- } else {
- SkASSERT(NULL != gifOut);
- fGif.reset(gifOut);
- }
}
// Check for valid input parameters

Powered by Google App Engine
This is Rietveld 408576698