Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 1403 of file SkJpegCodec.cpp.

1405 {
1406 if (!data) {
1407 if (outResult) {
1408 *outResult = SkCodec::kInvalidInput;
1409 }
1410 return nullptr;
1411 }
1412 return Decode(SkMemoryStream::Make(std::move(data)), outResult, nullptr);
1413}
@ 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 > 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 1393 of file SkJpegCodec.cpp.

1395 {
1396 SkCodec::Result resultStorage;
1397 if (!outResult) {
1398 outResult = &resultStorage;
1399 }
1400 return SkJpegCodec::MakeFromStream(std::move(stream), outResult);
1401}
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)

◆ IsJpeg()

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

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

Definition at line 1389 of file SkJpegCodec.cpp.

1389 {
1390 return SkJpegCodec::IsJpeg(data, len);
1391}
static bool IsJpeg(const void *, size_t)