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

Functions

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

Definition at line 427 of file SkIcoCodec.cpp.

429 {
430 if (!data) {
431 if (outResult) {
432 *outResult = SkCodec::kInvalidInput;
433 }
434 return nullptr;
435 }
436 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
437}
@ 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 > SkIcoDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a ICO.

If the bytes are not a ICO, returns nullptr.

DecodeContext is ignored

Definition at line 417 of file SkIcoCodec.cpp.

419 {
420 SkCodec::Result resultStorage;
421 if (!outResult) {
422 outResult = &resultStorage;
423 }
424 return SkIcoCodec::MakeFromStream(std::move(stream), outResult);
425}
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkIcoDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkIcoDecoder.h.

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

◆ IsIco()

bool SkIcoDecoder::IsIco ( const void *  data,
size_t  len 
)

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

Definition at line 413 of file SkIcoCodec.cpp.

413 {
414 return SkIcoCodec::IsIco(data, len);
415}
static bool IsIco(const void *, size_t)