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

Unified Diff: src/codec/SkCodec_wbmp.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_wbmp.cpp
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 86dce5cc89e95590f8d0d138df9bda352994f95d..52535e1f029a2c065c0a04fc3c8690b4398ce8e3 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -66,16 +66,8 @@ static bool read_header(SkStream* stream, SkISize* size) {
return true;
}
-bool SkWbmpCodec::handleRewind() {
- SkCodec::RewindState rewindState = this->rewindIfNeeded();
- if (rewindState == kCouldNotRewind_RewindState) {
- return false;
- } else if (rewindState == kRewound_RewindState) {
- if (!read_header(this->stream(), NULL)) {
- return false;
- }
- }
- return true;
+bool SkWbmpCodec::onRewind() {
+ return read_header(this->stream(), NULL);
}
SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
@@ -117,7 +109,7 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
const Options& options,
SkPMColor ctable[],
int* ctableCount) {
- if (!this->handleRewind()) {
+ if (!this->rewindIfNeeded()) {
return kCouldNotRewind;
}
if (options.fSubset) {
@@ -197,7 +189,7 @@ public:
SkCodec::Result onStart(const SkImageInfo& dstInfo,
const SkCodec::Options& options, SkPMColor inputColorTable[],
int* inputColorCount) {
- if (!fCodec->handleRewind()) {
+ if (!fCodec->rewindIfNeeded()) {
return SkCodec::kCouldNotRewind;
}
if (options.fSubset) {
« src/codec/SkBmpCodec.h ('K') | « src/codec/SkCodec_wbmp.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698