lin
2025-08-14 dae8bad597b6607a449b32bf76c523423f7720ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * 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 "SkColorSpace.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 std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>, Result*);
 
    ~SkRawCodec() override;
 
protected:
 
    Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, const Options&,
            int*) override;
 
    SkEncodedImageFormat onGetEncodedFormat() const override {
        return SkEncodedImageFormat::kDNG;
    }
 
    SkISize onGetScaledDimensions(float desiredScale) const override;
 
    bool onDimensionsSupported(const SkISize&) override;
 
    // SkCodec only applies the colorXform if it's necessary for color space
    // conversion. SkRawCodec will always convert, so tell SkCodec not to.
    bool usesColorXform() const override { return false; }
 
private:
 
    /*
     * Creates an instance of the decoder
     * Called only by NewFromStream, takes ownership of dngImage.
     */
    SkRawCodec(SkDngImage* dngImage);
 
    std::unique_ptr<SkDngImage> fDngImage;
 
    typedef SkCodec INHERITED;
};
 
#endif