aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodec_libpng.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@chromium.org>2015-08-12 07:24:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-12 07:24:13 -0700
commitb427db1d457a083f2652756a453fbb91bc6a7447 (patch)
tree7f75aa76f1b488fb97a5fa4222c1a04a2906a5ae /src/codec/SkCodec_libpng.h
parent4b5472bdb05404681388b5c5a4962f24a76e088b (diff)
Consolidate SkCodec functions for handling rewind
Previously, many of our codec implementations followed the same pattern (often in a function named handleRewind): switch (this->rewindIfNeeded()) { case CouldNotRewind: return CouldNotRewind; case NoRewindNecessary: // keep going break; case Rewound: <re-read header etc> break; } In this CL, remove the enum, and put the piece that happens in the Rewound case into a virtual function, onRewind. rewindIfNeeded now contains the common pieces from various functions named handleRewind. In SkBmpCodec, add a function that returns whether the BMP is in ICO, so it can have a common implementation for onRewind. BUG=skia:3257 Review URL: https://codereview.chromium.org/1288483002
Diffstat (limited to 'src/codec/SkCodec_libpng.h')
-rw-r--r--src/codec/SkCodec_libpng.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/codec/SkCodec_libpng.h b/src/codec/SkCodec_libpng.h
index 21bbdadb49..890402200c 100644
--- a/src/codec/SkCodec_libpng.h
+++ b/src/codec/SkCodec_libpng.h
@@ -35,6 +35,7 @@ protected:
Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMColor*, int*)
override;
SkEncodedFormat onGetEncodedFormat() const override { return kPNG_SkEncodedFormat; }
+ bool onRewind() override;
bool onReallyHasAlpha() const override { return fReallyHasAlpha; }
private:
png_structp fPng_ptr;
@@ -56,8 +57,6 @@ private:
Result initializeSwizzler(const SkImageInfo& requestedInfo, const Options&,
SkPMColor*, int* ctableCount);
- // Calls rewindIfNeeded and returns true if the decoder can continue.
- bool handleRewind();
bool decodePalette(bool premultiply, int* ctableCount);
void destroyReadStruct();