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

Unified Diff: include/core/SkImageDecoder.h

Issue 1040453002: Add SkPngChunkReader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Peeker -> SkChunkReader, passed to constructor. Created 5 years, 9 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: include/core/SkImageDecoder.h
diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index f4ae78a378baa83cf02bf7401c419325b6386ab7..fdf8b54a2213b58c0df612d3d513cbaf59ed98f2 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -9,6 +9,7 @@
#define SkImageDecoder_DEFINED
#include "SkBitmap.h"
+#include "SkChunkReader.h"
#include "SkImage.h"
#include "SkRect.h"
#include "SkRefCnt.h"
@@ -126,25 +127,8 @@ public:
*/
bool getRequireUnpremultipliedColors() const { return fRequireUnpremultipliedColors; }
- /** \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:
- SK_DECLARE_INST_COUNT(Peeker)
-
- /** 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;
- };
-
- Peeker* getPeeker() const { return fPeeker; }
- Peeker* setPeeker(Peeker*);
+ SkChunkReader* getPeeker() const { return fPeeker; }
+ SkChunkReader* setPeeker(SkChunkReader*);
/**
* By default, the codec will try to comply with the "pref" colortype
@@ -231,7 +215,7 @@ public:
to allocate the memory from a cache, volatile memory, or even from
an existing bitmap's memory.
- If a Peeker is installed via setPeeker, it may be used to peek into
+ If a SkChunkReader is installed via setPeeker, it may be used to peek into
meta data during the decode.
*/
Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode);
@@ -401,7 +385,7 @@ protected:
SkColorType getPrefColorType(SrcDepth, bool hasAlpha) const;
private:
- Peeker* fPeeker;
+ SkChunkReader* fPeeker;
SkBitmap::Allocator* fAllocator;
int fSampleSize;
SkColorType fDefaultPref; // use if fUsePrefTable is false

Powered by Google App Engine
This is Rietveld 408576698