Flutter Engine
The Flutter Engine
Functions
SkJpegDecoder Namespace Reference

Functions

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

Definition at line 944 of file SkJpegCodec.cpp.

946 {
947 if (!data) {
948 if (outResult) {
949 *outResult = SkCodec::kInvalidInput;
950 }
951 return nullptr;
952 }
953 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
954}
@ 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 > SkJpegDecoder::Decode ( std::unique_ptr< SkStream stream,
SkCodec::Result outResult,
SkCodecs::DecodeContext  = nullptr 
)

Attempts to decode the given bytes as a JPEG.

If the bytes are not a JPEG, returns nullptr.

DecodeContext is ignored

Definition at line 934 of file SkJpegCodec.cpp.

936 {
937 SkCodec::Result resultStorage;
938 if (!outResult) {
939 outResult = &resultStorage;
940 }
941 return SkJpegCodec::MakeFromStream(std::move(stream), outResult);
942}
Result
Definition: SkCodec.h:76
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, Result *)

◆ Decoder()

constexpr SkCodecs::Decoder SkJpegDecoder::Decoder ( )
inlineconstexpr

Definition at line 38 of file SkJpegDecoder.h.

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

◆ IsJpeg()

bool SkJpegDecoder::IsJpeg ( const void *  data,
size_t  len 
)

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

Definition at line 930 of file SkJpegCodec.cpp.

930 {
932}
static bool IsJpeg(const void *, size_t)
Definition: SkJpegCodec.cpp:56