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

Unified Diff: src/codec/SkCodec.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.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index ffe90af5399004b3dcde1155ec1a8309890c7ede..3e5ebe185091488cc45ec5bea0c65d70ca7e0578 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -83,16 +83,20 @@ SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream)
SkCodec::~SkCodec() {}
-SkCodec::RewindState SkCodec::rewindIfNeeded() {
+bool SkCodec::rewindIfNeeded() {
// Store the value of fNeedsRewind so we can update it. Next read will
// require a rewind.
const bool needsRewind = fNeedsRewind;
fNeedsRewind = true;
if (!needsRewind) {
- return kNoRewindNecessary_RewindState;
+ return true;
}
- return fStream->rewind() ? kRewound_RewindState
- : kCouldNotRewind_RewindState;
+
+ if (!fStream->rewind()) {
+ return false;
+ }
+
+ return this->onRewind();
}
SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,

Powered by Google App Engine
This is Rietveld 408576698