Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
EncodeBench Class Reference
Inheritance diagram for EncodeBench:
Benchmark SkRefCnt SkRefCntBase

Public Types

using Encoder = bool(*)(SkWStream *, const SkPixmap &)
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 EncodeBench (const char *filename, Encoder encoder, const char *encoderName)
 
bool isSuitableFor (Backend backend) override
 
const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *) override
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
virtual bool isSuitableFor (Backend backend)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual bool shouldLoop () const
 
void delayedSetup ()
 
void perCanvasPreDraw (SkCanvas *)
 
void perCanvasPostDraw (SkCanvas *)
 
void preDraw (SkCanvas *)
 
void postDraw (SkCanvas *)
 
void draw (int loops, SkCanvas *)
 
virtual void getGpuStats (SkCanvas *, skia_private::TArray< SkString > *keys, skia_private::TArray< double > *values)
 
virtual bool getDMSAAStats (GrRecordingContext *)
 
int getUnits () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetName ()=0
 
virtual const char * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual void onDraw (int loops, SkCanvas *)=0
 
virtual SkISize onGetSize ()
 

Detailed Description

Definition at line 22 of file EncodeBench.cpp.

Member Typedef Documentation

◆ Encoder

using EncodeBench::Encoder = bool (*)(SkWStream*, const SkPixmap&)

Definition at line 24 of file EncodeBench.cpp.

Constructor & Destructor Documentation

◆ EncodeBench()

EncodeBench::EncodeBench ( const char *  filename,
Encoder  encoder,
const char *  encoderName 
)
inline

Definition at line 25 of file EncodeBench.cpp.

26 : fSourceFilename(filename)
27 , fEncoder(encoder)
28 , fName(SkStringPrintf("Encode_%s_%s", filename, encoderName)) {}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.

Member Function Documentation

◆ isSuitableFor()

bool EncodeBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 30 of file EncodeBench.cpp.

const char * backend

◆ onDelayedSetup()

void EncodeBench::onDelayedSetup ( )
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 34 of file EncodeBench.cpp.

34 {
35 SkAssertResult(ToolUtils::GetResourceAsBitmap(fSourceFilename, &fBitmap));
36 }
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
bool GetResourceAsBitmap(const char *resource, SkBitmap *dst)
Definition: DecodeUtils.h:21

◆ onDraw()

void EncodeBench::onDraw ( int  loops,
SkCanvas  
)
inlineoverridevirtual

Implements Benchmark.

Definition at line 38 of file EncodeBench.cpp.

38 {
39 while (loops-- > 0) {
40 SkPixmap pixmap;
41 SkAssertResult(fBitmap.peekPixels(&pixmap));
43 SkAssertResult(fEncoder(&dst, pixmap));
44 SkASSERT(dst.bytesWritten() > 0);
45 }
46 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool peekPixels(SkPixmap *pixmap) const
Definition: SkBitmap.cpp:635
dst
Definition: cp.py:12

◆ onGetName()

const char * EncodeBench::onGetName ( )
inlineoverridevirtual

Implements Benchmark.

Definition at line 32 of file EncodeBench.cpp.

32{ return fName.c_str(); }
const char * c_str() const
Definition: SkString.h:133

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