Flutter Engine
The Flutter Engine
Functions
SkAvifDecoder Namespace Reference

Functions

SK_API bool IsAvif (const void *, size_t)
 
SK_API std::unique_ptr< SkCodecDecode (std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 
SK_API std::unique_ptr< SkCodecDecode (sk_sp< SkData >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
 
constexpr SkCodecs::Decoder Decoder ()
 

Function Documentation

◆ Decode() [1/2]

std::unique_ptr< SkCodec > SkAvifDecoder::Decode ( sk_sp< SkData data,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Definition at line 259 of file SkAvifCodec.cpp.

261 {
262 if (!data) {
263 if (outResult) {
264 *outResult = SkCodec::kInvalidInput;
265 }
266 return nullptr;
267 }
268 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
269}
@ kInvalidInput
Definition: SkCodec.h:109
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
Definition: SkStream.cpp:314
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ Decode() [2/2]

std::unique_ptr< SkCodec > SkAvifDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a AVIF.

If the bytes are not a AVIF, returns nullptr.

DecodeContext is ignored

Definition at line 249 of file SkAvifCodec.cpp.

251 {
252 SkCodec::Result resultStorage;
253 if (!outResult) {
254 outResult = &resultStorage;
255 }
256 return SkAvifCodec::MakeFromStream(std::move(stream), outResult);
257}
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)
Definition: SkAvifCodec.cpp:45
Result
Definition: SkCodec.h:76

◆ Decoder()

constexpr SkCodecs::Decoder SkAvifDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkAvifDecoder.h.

38 {
39 return { "avif", IsAvif, Decode };
40}
SK_API std::unique_ptr< SkCodec > Decode(sk_sp< SkData >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
SK_API bool IsAvif(const void *, size_t)

◆ IsAvif()

bool SkAvifDecoder::IsAvif ( const void *  data,
size_t  len 
)

Returns true if this data claims to be a AVIF image.

Definition at line 245 of file SkAvifCodec.cpp.

245 {
247}
static bool IsAvif(const void *, size_t)
Definition: SkAvifCodec.cpp:33