Flutter Engine
The Flutter Engine
third_party
skia
include
codec
SkRawDecoder.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC
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
#ifndef SkRawDecoder_DEFINED
8
#define SkRawDecoder_DEFINED
9
10
#include "
include/codec/SkCodec.h
"
11
#include "
include/core/SkRefCnt.h
"
12
#include "
include/private/base/SkAPI.h
"
13
14
class
SkData
;
15
class
SkStream
;
16
17
#include <memory>
18
19
namespace
SkRawDecoder
{
20
21
inline
bool
IsRaw
(
const
void
*,
size_t
) {
22
// Raw formats are tricky to detect just by reading in the first several bytes.
23
// For example, PIEX might need to read 10k bytes to detect Sony's arw format
24
// https://github.com/google/piex/blob/f1e15dd837c04347504149f71db67a78fbeddc73/src/image_type_recognition/image_type_recognition_lite.cc#L152
25
// Thus, we just assume everything might be a RAW file and check it last.
26
return
true
;
27
}
28
29
/**
30
* Attempts to decode the given bytes as a raw image.
31
*
32
* If the bytes are not a raw, returns nullptr.
33
*
34
* DecodeContext is ignored
35
*/
36
SK_API
std::unique_ptr<SkCodec>
Decode
(std::unique_ptr<SkStream>,
37
SkCodec::Result
*,
38
SkCodecs::DecodeContext
=
nullptr
);
39
SK_API
std::unique_ptr<SkCodec>
Decode
(
sk_sp<SkData>
,
40
SkCodec::Result
*,
41
SkCodecs::DecodeContext
=
nullptr
);
42
43
// This decoder will always be checked last, no matter when it is registered.
44
inline
constexpr
SkCodecs::Decoder
Decoder
() {
45
return
{
"raw"
,
IsRaw
,
Decode
};
46
}
47
48
}
// namespace SkRawDecoder
49
50
#endif
// SkRawDecoder_DEFINED
SkAPI.h
SK_API
#define SK_API
Definition:
SkAPI.h:35
SkCodec.h
SkRefCnt.h
SkCodec::Result
Result
Definition:
SkCodec.h:76
SkData
Definition:
SkData.h:25
SkStream
Definition:
SkStream.h:29
sk_sp< SkData >
SkCodecs::DecodeContext
void * DecodeContext
Definition:
SkCodec.h:1047
SkRawDecoder
Definition:
SkRawDecoder.h:19
SkRawDecoder::Decode
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
Definition:
SkRawCodec.cpp:835
SkRawDecoder::IsRaw
bool IsRaw(const void *, size_t)
Definition:
SkRawDecoder.h:21
SkRawDecoder::Decoder
constexpr SkCodecs::Decoder Decoder()
Definition:
SkRawDecoder.h:44
SkCodecs::Decoder
Definition:
SkCodec.h:1053
Generated on Sun Jun 23 2024 21:56:02 for Flutter Engine by
1.9.4