Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkWuffsCodec Class Referencefinal
Inheritance diagram for SkWuffsCodec:
SkScalingCodec SkCodec SkNoncopyable

Public Member Functions

 SkWuffsCodec (SkEncodedInfo &&encodedInfo, std::unique_ptr< SkStream > stream, bool canSeek, std::unique_ptr< wuffs_gif__decoder, decltype(&sk_free)> dec, std::unique_ptr< uint8_t, decltype(&sk_free)> workbuf_ptr, size_t workbuf_len, wuffs_base__image_config imgcfg, wuffs_base__io_buffer iobuf)
 
const SkWuffsFrameframe (int i) const
 
std::unique_ptr< SkStreamgetEncodedData () const override
 
- Public Member Functions inherited from SkCodec
virtual ~SkCodec ()
 
SkImageInfo getInfo () const
 
SkISize dimensions () const
 
SkIRect bounds () const
 
const skcms_ICCProfilegetICCProfile () const
 
SkEncodedOrigin getOrigin () const
 
SkISize getScaledDimensions (float desiredScale) const
 
bool getValidSubset (SkIRect *desiredSubset) const
 
SkEncodedImageFormat getEncodedFormat () const
 
virtual std::unique_ptr< SkStreamgetEncodedData () const
 
Result getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes, const Options *)
 
Result getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes)
 
Result getPixels (const SkPixmap &pm, const Options *opts=nullptr)
 
std::tuple< sk_sp< SkImage >, SkCodec::ResultgetImage (const SkImageInfo &info, const Options *opts=nullptr)
 
std::tuple< sk_sp< SkImage >, SkCodec::ResultgetImage ()
 
bool queryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const
 
Result getYUVAPlanes (const SkYUVAPixmaps &yuvaPixmaps)
 
Result startIncrementalDecode (const SkImageInfo &dstInfo, void *dst, size_t rowBytes, const Options *)
 
Result startIncrementalDecode (const SkImageInfo &dstInfo, void *dst, size_t rowBytes)
 
Result incrementalDecode (int *rowsDecoded=nullptr)
 
Result startScanlineDecode (const SkImageInfo &dstInfo, const Options *options)
 
Result startScanlineDecode (const SkImageInfo &dstInfo)
 
int getScanlines (void *dst, int countLines, size_t rowBytes)
 
bool skipScanlines (int countLines)
 
SkScanlineOrder getScanlineOrder () const
 
int nextScanline () const
 
int outputScanline (int inputScanline) const
 
int getFrameCount ()
 
bool getFrameInfo (int index, FrameInfo *info) const
 
std::vector< FrameInfogetFrameInfo ()
 
int getRepetitionCount ()
 

Additional Inherited Members

- Public Types inherited from SkCodec
enum  Result {
  kSuccess , kIncompleteInput , kErrorInInput , kInvalidConversion ,
  kInvalidScale , kInvalidParameters , kInvalidInput , kCouldNotRewind ,
  kInternalError , kUnimplemented
}
 
enum class  SelectionPolicy { kPreferStillImage , kPreferAnimation }
 
enum  ZeroInitialized { kYes_ZeroInitialized , kNo_ZeroInitialized }
 
enum  SkScanlineOrder { kTopDown_SkScanlineOrder , kBottomUp_SkScanlineOrder }
 
- Static Public Member Functions inherited from SkCodec
static constexpr size_t MinBufferedBytesNeeded ()
 
static const char * ResultToString (Result)
 
static std::unique_ptr< SkCodecMakeFromStream (std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
 
static std::unique_ptr< SkCodecMakeFromStream (std::unique_ptr< SkStream >, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
 
static std::unique_ptr< SkCodecMakeFromData (sk_sp< SkData >, SkSpan< const SkCodecs::Decoder > decoders, SkPngChunkReader *=nullptr)
 
static std::unique_ptr< SkCodecMakeFromData (sk_sp< SkData >, SkPngChunkReader *=nullptr)
 
static void Register (bool(*peek)(const void *, size_t), std::unique_ptr< SkCodec >(*make)(std::unique_ptr< SkStream >, SkCodec::Result *))
 
- Static Public Attributes inherited from SkCodec
static constexpr int kNoFrame = -1
 
static constexpr int kRepetitionCountInfinite = -1
 
- Protected Types inherited from SkCodec
using XformFormat = skcms_PixelFormat
 
- Protected Member Functions inherited from SkScalingCodec
 SkScalingCodec (SkEncodedInfo &&info, XformFormat srcFormat, std::unique_ptr< SkStream > stream, SkEncodedOrigin origin=kTopLeft_SkEncodedOrigin)
 
SkISize onGetScaledDimensions (float desiredScale) const override
 
bool onDimensionsSupported (const SkISize &requested) override
 
- Protected Member Functions inherited from SkCodec
const SkEncodedInfogetEncodedInfo () const
 
 SkCodec (SkEncodedInfo &&, XformFormat srcFormat, std::unique_ptr< SkStream >, SkEncodedOrigin=kTopLeft_SkEncodedOrigin)
 
void setSrcXformFormat (XformFormat pixelFormat)
 
XformFormat getSrcXformFormat () const
 
virtual bool onGetGainmapInfo (SkGainmapInfo *, std::unique_ptr< SkStream > *)
 
virtual SkISize onGetScaledDimensions (float) const
 
virtual bool onDimensionsSupported (const SkISize &)
 
virtual SkEncodedImageFormat onGetEncodedFormat () const =0
 
virtual Result onGetPixels (const SkImageInfo &info, void *pixels, size_t rowBytes, const Options &, int *rowsDecoded)=0
 
virtual bool onQueryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const
 
virtual Result onGetYUVAPlanes (const SkYUVAPixmaps &)
 
virtual bool onGetValidSubset (SkIRect *) const
 
bool rewindIfNeeded ()
 
virtual bool onRewind ()
 
SkStreamstream ()
 
virtual SkScanlineOrder onGetScanlineOrder () const
 
const SkImageInfodstInfo () const
 
const Optionsoptions () const
 
int currScanline () const
 
virtual int onOutputScanline (int inputScanline) const
 
virtual bool conversionSupported (const SkImageInfo &dst, bool srcIsOpaque, bool needsColorXform)
 
virtual bool usesColorXform () const
 
void applyColorXform (void *dst, const void *src, int count) const
 
bool colorXform () const
 
bool xformOnDecode () const
 
virtual int onGetFrameCount ()
 
virtual bool onGetFrameInfo (int, FrameInfo *) const
 
virtual int onGetRepetitionCount ()
 

Detailed Description

Definition at line 237 of file SkWuffsCodec.cpp.

Constructor & Destructor Documentation

◆ SkWuffsCodec()

SkWuffsCodec::SkWuffsCodec ( SkEncodedInfo &&  encodedInfo,
std::unique_ptr< SkStream stream,
bool  canSeek,
std::unique_ptr< wuffs_gif__decoder, decltype(&sk_free)>  dec,
std::unique_ptr< uint8_t, decltype(&sk_free)>  workbuf_ptr,
size_t  workbuf_len,
wuffs_base__image_config  imgcfg,
wuffs_base__io_buffer  iobuf 
)

Definition at line 380 of file SkWuffsCodec.cpp.

388 : INHERITED(std::move(encodedInfo),
390 // Pass a nullptr SkStream to the SkCodec constructor. We
391 // manage the stream ourselves, as the default SkCodec behavior
392 // is too trigger-happy on rewinding the stream.
393 nullptr),
394 fFrameHolder(),
395 fPrivStream(std::move(stream)),
396 fWorkbufPtr(std::move(workbuf_ptr)),
397 fWorkbufLen(workbuf_len),
398 fDecoder(std::move(dec)),
399 fFirstFrameIOPosition(imgcfg.first_frame_io_position()),
400 fFrameConfig(wuffs_base__null_frame_config()),
401 fPixelConfig(imgcfg.pixcfg),
402 fPixelBuffer(wuffs_base__null_pixel_buffer()),
403 fIOBuffer(wuffs_base__empty_io_buffer()),
404 fIncrDecDst(nullptr),
405 fIncrDecRowBytes(0),
406 fIncrDecPixelBlend(WUFFS_BASE__PIXEL_BLEND__SRC),
407 fIncrDecOnePass(false),
408 fFirstCallToIncrementalDecode(false),
409 fTwoPassPixbufPtr(nullptr, &sk_free),
410 fTwoPassPixbufLen(0),
411 fNumFullyReceivedFrames(0),
412 fFramesComplete(false),
413 fDecoderIsSuspended(false),
414 fCanSeek(canSeek) {
415 fFrameHolder.init(this, imgcfg.pixcfg.width(), imgcfg.pixcfg.height());
416
417 // Initialize fIOBuffer's fields, copying any outstanding data from iobuf to
418 // fIOBuffer, as iobuf's backing array may not be valid for the lifetime of
419 // this SkWuffsCodec object, but fIOBuffer's backing array (fBuffer) is.
420 SkASSERT(iobuf.data.len == SK_WUFFS_CODEC_BUFFER_SIZE);
421 memmove(fBuffer, iobuf.data.ptr, iobuf.meta.wi);
422 fIOBuffer.data = wuffs_base__make_slice_u8(fBuffer, SK_WUFFS_CODEC_BUFFER_SIZE);
423 fIOBuffer.meta = iobuf.meta;
424}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SK_API void sk_free(void *)
#define SK_WUFFS_CODEC_BUFFER_SIZE
SkStream * stream()
Definition: SkCodec.h:865
void init(SkWuffsCodec *codec, int width, int height)
@ skcms_PixelFormat_RGBA_8888
Definition: skcms_public.h:287

Member Function Documentation

◆ frame()

const SkWuffsFrame * SkWuffsCodec::frame ( int  i) const

Definition at line 426 of file SkWuffsCodec.cpp.

426 {
427 if ((0 <= i) && (static_cast<size_t>(i) < fFrames.size())) {
428 return &fFrames[i];
429 }
430 return nullptr;
431}

◆ getEncodedData()

std::unique_ptr< SkStream > SkWuffsCodec::getEncodedData ( ) const
overridevirtual

Return the underlying encoded data stream. This may be nullptr if the original stream could not be duplicated.

Reimplemented from SkCodec.

Definition at line 970 of file SkWuffsCodec.cpp.

970 {
971 SkASSERT(fPrivStream);
972 return fPrivStream->duplicate();
973}

The documentation for this class was generated from the following file: