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

Functions

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

Definition at line 226 of file SkWbmpCodec.cpp.

228 {
229 if (!data) {
230 if (outResult) {
231 *outResult = SkCodec::kInvalidInput;
232 }
233 return nullptr;
234 }
235 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
236}
@ 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 > SkWbmpDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a WBMP.

If the bytes are not a WBMP, returns nullptr.

DecodeContext is ignored

Definition at line 216 of file SkWbmpCodec.cpp.

218 {
219 SkCodec::Result resultStorage;
220 if (!outResult) {
221 outResult = &resultStorage;
222 }
223 return SkWbmpCodec::MakeFromStream(std::move(stream), outResult);
224}
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkWbmpDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkWbmpDecoder.h.

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

◆ IsWbmp()

bool SkWbmpDecoder::IsWbmp ( const void *  data,
size_t  len 
)

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

Definition at line 212 of file SkWbmpCodec.cpp.

212 {
213 return SkWbmpCodec::IsWbmp(data, len);
214}
static bool IsWbmp(const void *, size_t)