Flutter Engine
The Flutter Engine
Functions
SkJpegxlDecoder Namespace Reference

Functions

SK_API bool IsJpegxl (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 > SkJpegxlDecoder::Decode ( sk_sp< SkData data,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Definition at line 484 of file SkJpegxlCodec.cpp.

486 {
487 if (!data) {
488 if (outResult) {
489 *outResult = SkCodec::kInvalidInput;
490 }
491 return nullptr;
492 }
493 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
494}
@ 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 > SkJpegxlDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a JPEGXL.

If the bytes are not a JPEGXL, returns nullptr.

DecodeContext is ignored

Definition at line 474 of file SkJpegxlCodec.cpp.

476 {
477 SkCodec::Result resultStorage;
478 if (!outResult) {
479 outResult = &resultStorage;
480 }
481 return SkJpegxlCodec::MakeFromStream(std::move(stream), outResult);
482}
Result
Definition: SkCodec.h:76
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkJpegxlDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkJpegxlDecoder.h.

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

◆ IsJpegxl()

bool SkJpegxlDecoder::IsJpegxl ( const void *  data,
size_t  len 
)

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

Definition at line 470 of file SkJpegxlCodec.cpp.

470 {
472}
static bool IsJpegxl(const void *, size_t)