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

Functions

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

Definition at line 684 of file SkBmpCodec.cpp.

686 {
687 if (!data) {
688 if (outResult) {
689 *outResult = SkCodec::kInvalidInput;
690 }
691 return nullptr;
692 }
693 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
694}
@ 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 > SkBmpDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a BMP.

If the bytes are not a BMP, returns nullptr.

DecodeContext is ignored

Definition at line 674 of file SkBmpCodec.cpp.

676 {
677 SkCodec::Result resultStorage;
678 if (!outResult) {
679 outResult = &resultStorage;
680 }
681 return SkBmpCodec::MakeFromStream(std::move(stream), outResult);
682}
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkBmpDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkBmpDecoder.h.

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

◆ IsBmp()

bool SkBmpDecoder::IsBmp ( const void *  data,
size_t  len 
)

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

Definition at line 670 of file SkBmpCodec.cpp.

670 {
671 return SkBmpCodec::IsBmp(data, len);
672}
static bool IsBmp(const void *, size_t)