Flutter Engine
The Flutter Engine
Functions
SkHeifDecoder Namespace Reference

Functions

SK_API bool IsHeif (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)
 
SkCodecs::Decoder Decoder ()
 

Function Documentation

◆ Decode() [1/2]

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

Definition at line 556 of file SkHeifCodec.cpp.

558 {
559 if (!data) {
560 if (outResult) {
561 *outResult = SkCodec::kInvalidInput;
562 }
563 return nullptr;
564 }
565 return Decode(SkMemoryStream::Make(std::move(data)), outResult, ctx);
566}
@ 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 > SkHeifDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  ctx = nullptr 
)

Attempts to decode the given bytes as a HEIF (or AVIF).

If the bytes are not a HEIF (or AVIF), returns nullptr.

DecodeContext is treated as a SkCodec::SelectionPolicy*

Definition at line 544 of file SkHeifCodec.cpp.

546 {
547 SkASSERT(ctx);
548 SkCodec::Result resultStorage;
549 if (!outResult) {
550 outResult = &resultStorage;
551 }
552 auto policy = static_cast<SkCodec::SelectionPolicy*>(ctx);
553 return SkHeifCodec::MakeFromStream(std::move(stream), *policy, outResult);
554}
#define SkASSERT(cond)
Definition: SkAssert.h:116
Result
Definition: SkCodec.h:76
SelectionPolicy
Definition: SkCodec.h:136
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkCodec::SelectionPolicy selectionPolicy, Result *)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
Definition: switches.h:248

◆ Decoder()

SkCodecs::Decoder SkHeifDecoder::Decoder ( )
inline

Definition at line 44 of file SkHeifDecoder.h.

44 {
45 return { "heif", IsHeif, Decode };
46}
SK_API bool IsHeif(const void *, size_t)
SK_API std::unique_ptr< SkCodec > Decode(sk_sp< SkData >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)

◆ IsHeif()

bool SkHeifDecoder::IsHeif ( const void *  data,
size_t  len 
)

Returns true if this data claims to be a HEIF (or AVIF) image.

Definition at line 540 of file SkHeifCodec.cpp.

540 {
541 return SkHeifCodec::IsSupported(data, len, nullptr);
542}
static bool IsSupported(const void *, size_t, SkEncodedImageFormat *format)
Definition: SkHeifCodec.cpp:21