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

Unified Diff: include/core/SkImageDecoder.h

Issue 1472863003: Revert of Add SkPngChunkReader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « include/codec/SkCodec.h ('k') | include/core/SkPngChunkReader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageDecoder.h
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index 30323b59ee56df2cf7f9ad3ac79d7f5833cbd3ea..144878c1668e74c46922df17ea988f4176e0afb3 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -10,13 +10,10 @@
#include "SkBitmap.h"
#include "SkImage.h"
-#include "SkPngChunkReader.h"
#include "SkRect.h"
#include "SkRefCnt.h"
#include "SkTRegistry.h"
#include "SkTypes.h"
-
-//#define SK_LEGACY_PEEKER
class SkStream;
class SkStreamRewindable;
@@ -129,20 +126,23 @@
*/
bool getRequireUnpremultipliedColors() const { return fRequireUnpremultipliedColors; }
-#ifdef SK_LEGACY_PEEKER
- // Android subclasses SkImageDecoder::Peeker, which has been changed into SkPngChunkReader.
- // Temporarily use this class until Android can be updated to directly inherit from
- // SkPngChunkReader.
- class Peeker : public SkPngChunkReader {
+ /** \class Peeker
+
+ Base class for optional callbacks to retrieve meta/chunk data out of
+ an image as it is being decoded.
+ */
+ class Peeker : public SkRefCnt {
public:
- bool readChunk(const char tag[], const void* data, size_t length) final {
- return this->peek(tag, data, length);
- }
+ /** Return true to continue decoding, or false to indicate an error, which
+ will cause the decoder to not return the image.
+ */
virtual bool peek(const char tag[], const void* data, size_t length) = 0;
+ private:
+ typedef SkRefCnt INHERITED;
};
-#endif
- SkPngChunkReader* getPeeker() const { return fPeeker; }
- SkPngChunkReader* setPeeker(SkPngChunkReader*);
+
+ Peeker* getPeeker() const { return fPeeker; }
+ Peeker* setPeeker(Peeker*);
/**
* By default, the codec will try to comply with the "pref" colortype
@@ -229,8 +229,8 @@
to allocate the memory from a cache, volatile memory, or even from
an existing bitmap's memory.
- If an SkPngChunkReader is installed via setPeeker, it may be used to
- peek into meta data during the decode.
+ If a Peeker is installed via setPeeker, it may be used to peek into
+ meta data during the decode.
*/
Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode);
Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) {
@@ -350,7 +350,7 @@
SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const;
private:
- SkPngChunkReader* fPeeker;
+ Peeker* fPeeker;
SkBitmap::Allocator* fAllocator;
int fSampleSize;
SkColorType fDefaultPref; // use if fUsePrefTable is false
« no previous file with comments | « include/codec/SkCodec.h ('k') | include/core/SkPngChunkReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698