Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SkEncoder Class Referenceabstract

#include <SkEncoder.h>

Inheritance diagram for SkEncoder:
SkNoncopyable SkJpegEncoderImpl SkPngEncoderImpl

Classes

struct  Frame
 

Public Member Functions

bool encodeRows (int numRows)
 
virtual ~SkEncoder ()
 

Protected Member Functions

virtual bool onEncodeRows (int numRows)=0
 
 SkEncoder (const SkPixmap &src, size_t storageBytes)
 

Protected Attributes

const SkPixmapfSrc
 
int fCurrRow
 
skia_private::AutoTMalloc< uint8_t > fStorage
 

Detailed Description

Definition at line 19 of file SkEncoder.h.

Constructor & Destructor Documentation

◆ ~SkEncoder()

virtual SkEncoder::~SkEncoder ( )
inlinevirtual

Definition at line 46 of file SkEncoder.h.

46{}

◆ SkEncoder()

SkEncoder::SkEncoder ( const SkPixmap src,
size_t  storageBytes 
)
inlineprotected

Definition at line 52 of file SkEncoder.h.

53 : fSrc(src)
54 , fCurrRow(0)
55 , fStorage(storageBytes)
56 {}
skia_private::AutoTMalloc< uint8_t > fStorage
Definition: SkEncoder.h:60
int fCurrRow
Definition: SkEncoder.h:59
const SkPixmap & fSrc
Definition: SkEncoder.h:58

Member Function Documentation

◆ encodeRows()

bool SkEncoder::encodeRows ( int  numRows)

Encode |numRows| rows of input. If the caller requests more rows than are remaining in the src, this will encode all of the remaining rows. |numRows| must be greater than zero.

Definition at line 12 of file SkEncoder.cpp.

12 {
13 SkASSERT(numRows > 0 && fCurrRow < fSrc.height());
14 if (numRows <= 0 || fCurrRow >= fSrc.height()) {
15 return false;
16 }
17
18 if (fCurrRow + numRows > fSrc.height()) {
19 numRows = fSrc.height() - fCurrRow;
20 }
21
22 if (!this->onEncodeRows(numRows)) {
23 // If we fail, short circuit any future calls.
25 return false;
26 }
27
28 return true;
29}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual bool onEncodeRows(int numRows)=0
int height() const
Definition: SkPixmap.h:166

◆ onEncodeRows()

virtual bool SkEncoder::onEncodeRows ( int  numRows)
protectedpure virtual

Implemented in SkJpegEncoderImpl, and SkPngEncoderImpl.

Member Data Documentation

◆ fCurrRow

int SkEncoder::fCurrRow
protected

Definition at line 59 of file SkEncoder.h.

◆ fSrc

const SkPixmap& SkEncoder::fSrc
protected

Definition at line 58 of file SkEncoder.h.

◆ fStorage

skia_private::AutoTMalloc<uint8_t> SkEncoder::fStorage
protected

Definition at line 60 of file SkEncoder.h.


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