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

Unified Diff: include/core/SkChunkReader.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/SkChunkReader.h
diff --git a/include/core/SkChunkReader.h b/include/core/SkChunkReader.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab1f135512f808df2c2a2fbe3c0ee92aacac0ae6
--- /dev/null
+++ b/include/core/SkChunkReader.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkChunkReader_DEFINED
+#define SkChunkReader_DEFINED
+
+#include "SkTypes.h"
+#include "SkRefCnt.h"
+
+/**
+ * ChunkReader
reed1 2015/03/27 20:13:47 ImageChunkReader, or PNGChunkReader? It just feel
scroggo 2015/04/01 14:53:48 Done.
+ * Base class for optional callbacks to retrieve meta/chunk data out of an
+ * encoded image as it is being decoded.
+ * Used by SkImageDecoder and SkCodec.
+ */
+class SkChunkReader : public SkRefCnt {
scroggo 2015/03/27 19:19:59 How's the name? Or maybe it should be ChunkParser?
+public:
+ SK_DECLARE_INST_COUNT(SkChunkReader)
+
+ /**
+ * This will be called by the decoder when it sees an unknown chunk.
+ *
+ * @param tag Name for this type of chunk.
+ * @param data Data to be interpreted by the subclass.
+ * @param length Number of bytes of data in the chunk.
+ * @return true to continue decoding, or false to indicate an error, which
+ * will cause the decoder to not return the image.
+ */
+ virtual bool readChunk(const char tag[], const void* data, size_t length) = 0;
+};
+#endif // SkChunkReader_DEFINED

Powered by Google App Engine
This is Rietveld 408576698