aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkRawCodec.h
diff options
context:
space:
mode:
authorGravatar yujieqin <yujieqin@google.com>2016-01-25 08:26:16 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-25 08:26:16 -0800
commit916de9ff18cf3caa29c0821b55244060b6f84f9d (patch)
tree2eeca150de2fe391a8498339138e135154f7bcc1 /src/codec/SkRawCodec.h
parentd03b7ae1e273e871d951c94fd9626d62acee9379 (diff)
Add RAW decoding into Skia.
Diffstat (limited to 'src/codec/SkRawCodec.h')
-rw-r--r--src/codec/SkRawCodec.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/codec/SkRawCodec.h b/src/codec/SkRawCodec.h
new file mode 100644
index 0000000000..42755c3ef1
--- /dev/null
+++ b/src/codec/SkRawCodec.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkRawCodec_DEFINED
+#define SkRawCodec_DEFINED
+
+#include "SkCodec.h"
+#include "SkImageInfo.h"
+#include "SkTypes.h"
+
+class SkDngImage;
+class SkStream;
+
+/*
+ *
+ * This class implements the decoding for RAW images
+ *
+ */
+class SkRawCodec : public SkCodec {
+public:
+
+ /*
+ * Creates a RAW decoder
+ * Takes ownership of the stream
+ */
+ static SkCodec* NewFromStream(SkStream*);
+
+ ~SkRawCodec() override;
+
+protected:
+
+ Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, const Options&,
+ SkPMColor*, int*, int*) override;
+
+ SkEncodedFormat onGetEncodedFormat() const override {
+ return kRAW_SkEncodedFormat;
+ }
+
+ SkISize onGetScaledDimensions(float desiredScale) const override;
+
+ bool onDimensionsSupported(const SkISize&) override;
+
+private:
+
+ /*
+ * Creates an instance of the decoder
+ * Called only by NewFromStream, takes ownership of dngImage.
+ */
+ SkRawCodec(SkDngImage* dngImage);
+
+ SkAutoTDelete<SkDngImage> fDngImage;
+
+ typedef SkCodec INHERITED;
+};
+
+#endif