Flutter Engine
The Flutter Engine
SkRawCodec.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkRawCodec_DEFINED
9#define SkRawCodec_DEFINED
10
13#include "include/core/SkSize.h"
15
16#include <cstddef>
17#include <memory>
18
19class SkDngImage;
20class SkStream;
21struct SkImageInfo;
22
23/*
24 *
25 * This class implements the decoding for RAW images
26 *
27 */
28class SkRawCodec : public SkCodec {
29public:
30
31 /*
32 * Creates a RAW decoder
33 * Takes ownership of the stream
34 */
35 static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>, Result*);
36
37 ~SkRawCodec() override;
38
39protected:
40
41 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, const Options&,
42 int*) override;
43
46 }
47
48 SkISize onGetScaledDimensions(float desiredScale) const override;
49
50 bool onDimensionsSupported(const SkISize&) override;
51
52 // SkCodec only applies the colorXform if it's necessary for color space
53 // conversion. SkRawCodec will always convert, so tell SkCodec not to.
54 bool usesColorXform() const override { return false; }
55
56private:
57
58 /*
59 * Creates an instance of the decoder
60 * Called only by NewFromStream, takes ownership of dngImage.
61 */
62 SkRawCodec(SkDngImage* dngImage);
63
64 std::unique_ptr<SkDngImage> fDngImage;
65
66 using INHERITED = SkCodec;
67};
68
69#endif
SkEncodedImageFormat
const SkImageInfo & dstInfo() const
Definition: SkCodec.h:878
SkCodec(SkEncodedInfo &&, XformFormat srcFormat, std::unique_ptr< SkStream >, SkEncodedOrigin=kTopLeft_SkEncodedOrigin)
Definition: SkCodec.cpp:250
Result
Definition: SkCodec.h:76
~SkRawCodec() override
Definition: SkRawCodec.cpp:824
SkEncodedImageFormat onGetEncodedFormat() const override
Definition: SkRawCodec.h:44
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)
Definition: SkRawCodec.cpp:649
Result onGetPixels(const SkImageInfo &dstInfo, void *dst, size_t dstRowBytes, const Options &, int *) override
Definition: SkRawCodec.cpp:717
bool onDimensionsSupported(const SkISize &) override
Definition: SkRawCodec.cpp:814
SkISize onGetScaledDimensions(float desiredScale) const override
Definition: SkRawCodec.cpp:786
bool usesColorXform() const override
Definition: SkRawCodec.h:54
dst
Definition: cp.py:12
Definition: SkSize.h:16