Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)

◆ 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 *)

◆ Decoder()

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

Definition at line 38 of file SkAvifDecoder.h.

38 {
39 return { "avif", IsAvif, Decode };
40}
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 {
246 return SkAvifCodec::IsAvif(data, len);
247}
static bool IsAvif(const void *, size_t)