Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkWebpDecoder Namespace Reference

Functions

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

Definition at line 599 of file SkWebpCodec.cpp.

601 {
602 if (!data) {
603 if (outResult) {
604 *outResult = SkCodec::kInvalidInput;
605 }
606 return nullptr;
607 }
608 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
609}
@ 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 > SkWebpDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a WEBP.

If the bytes are not a WEBP, returns nullptr.

DecodeContext is ignored

Definition at line 589 of file SkWebpCodec.cpp.

591 {
592 SkCodec::Result resultStorage;
593 if (!outResult) {
594 outResult = &resultStorage;
595 }
596 return SkWebpCodec::MakeFromStream(std::move(stream), outResult);
597}
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkWebpDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkWebpDecoder.h.

38 {
39 return { "webp", IsWebp, Decode };
40}
SK_API bool IsWebp(const void *, size_t)

◆ IsWebp()

bool SkWebpDecoder::IsWebp ( const void *  data,
size_t  len 
)

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

Definition at line 585 of file SkWebpCodec.cpp.

585 {
586 return SkWebpCodec::IsWebp(data, len);
587}
static bool IsWebp(const void *, size_t)