aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkCodec.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-11-23 08:14:40 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-23 08:14:40 -0800
commitcf98fa93116cf5efcc42d48c22fb4bd76896acdc (patch)
treedc2eef08cc61ea8b73d4650c0633b215b5aab37f /include/codec/SkCodec.h
parent93c69fff535075e86596a2b224f52f454b060be3 (diff)
Add SkPngChunkReader.
This class allows a client of SkCodec to read chunks in the data stream that are not recognized by libpng. This is used by Android to specify ninepatch data. Taken from SkImageDecoder::Peeker. Modify the name of the class and its method to be more specific to their use. Make SkImageDecoder::Peeker a subclass of the new class, to help stage the change in Android. Add a test to verify that it works. BUG=skia:4574 BUG=skia:3257 Committed: https://skia.googlesource.com/skia/+/3389e00136188800b98ca69488c0418c374fd78b Review URL: https://codereview.chromium.org/1040453002
Diffstat (limited to 'include/codec/SkCodec.h')
-rw-r--r--include/codec/SkCodec.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index d90fea8ced..dffab6b377 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -17,6 +17,7 @@
#include "SkTypes.h"
class SkData;
+class SkPngChunkReader;
class SkSampler;
/**
@@ -28,18 +29,24 @@ public:
* If this stream represents an encoded image that we know how to decode,
* return an SkCodec that can decode it. Otherwise return NULL.
*
+ * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if
+ * the image is a png.
+ *
* If NULL is returned, the stream is deleted immediately. Otherwise, the
* SkCodec takes ownership of it, and will delete it when done with it.
*/
- static SkCodec* NewFromStream(SkStream*);
+ static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL);
/**
* If this data represents an encoded image that we know how to decode,
* return an SkCodec that can decode it. Otherwise return NULL.
*
+ * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if
+ * the image is a png.
+ *
* Will take a ref if it returns a codec, else will not affect the data.
*/
- static SkCodec* NewFromData(SkData*);
+ static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL);
virtual ~SkCodec();