Index: src/codec/SkCodec_libico.h |
diff --git a/src/codec/SkCodec_libico.h b/src/codec/SkCodec_libico.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..281a1e7fc7f9ef130653a2b326234742c0b75c75 |
--- /dev/null |
+++ b/src/codec/SkCodec_libico.h |
@@ -0,0 +1,53 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkCodec.h" |
+#include "SkImageInfo.h" |
+#include "SkStream.h" |
+#include "SkTypes.h" |
+ |
+/* |
+ * This class implements the decoding for bmp images |
+ */ |
+class SkIcoCodec : public SkCodec { |
+public: |
+ |
+ /* |
+ * Checks the start of the stream to see if the image is a Ico or Cur |
+ */ |
+ static bool IsIco(SkStream*); |
+ |
+ /* |
+ * Assumes IsIco was called and returned true |
+ * Creates an Ico decoder |
+ * Reads enough of the stream to determine the image format |
+ */ |
+ static SkCodec* NewFromStream(SkStream*); |
+ |
+protected: |
+ |
+ /* |
+ * Initiates the Ico decode |
+ */ |
+ virtual Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
+ size_t dstRowBytes, const Options&, SkPMColor*, |
+ int*) SK_OVERRIDE; |
+ |
+private: |
+ |
+ /* |
+ * Constructor called by NewFromStream |
+ * @param embeddedCode codec for the embedded image |
+ */ |
+ SkIcoCodec(const SkImageInfo& srcInfo, SkCodec** embeddedCodecs, |
+ uint32_t numImages); |
+ |
+ SkAutoTDeleteArray<SkCodec*> fEmbeddedCodecs; // owned |
+ const uint32_t fNumImages; |
+ |
+ typedef SkCodec INHERITED; |
+}; |