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

Public Member Functions

 DrawBitmapAABench (bool doAA, const SkMatrix &matrix, const char name[])
 
- 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
 

Protected Member Functions

const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) override
 
- 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 ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

This bench measures the rendering time of SkCanvas::drawBitmap with different anti-aliasing / matrix combinations.

Definition at line 20 of file DrawBitmapAABench.cpp.

Constructor & Destructor Documentation

◆ DrawBitmapAABench()

DrawBitmapAABench::DrawBitmapAABench ( bool  doAA,
const SkMatrix matrix,
const char  name[] 
)
inline

Definition at line 22 of file DrawBitmapAABench.cpp.

23 : fMatrix(matrix)
24 , fName("draw_bitmap_") {
25
26 fPaint.setAntiAlias(doAA);
27 fName.appendf("%s_%s", doAA ? "aa" : "noaa", name);
28 }
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:550
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Member Function Documentation

◆ onDelayedSetup()

void DrawBitmapAABench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 35 of file DrawBitmapAABench.cpp.

35 {
37 surf->getCanvas()->clear(0xFF00FF00);
38 fImage = surf->makeImageSnapshot();
39 }
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkImageInfo MakeN32Premul(int width, int height)

◆ onDraw()

void DrawBitmapAABench::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 41 of file DrawBitmapAABench.cpp.

41 {
43 canvas->concat(fMatrix);
44 for (int i = 0; i < loops; i++) {
45 canvas->drawImage(fImage.get(), 0, 0, sampling, &fPaint);
46 }
47 }
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
T * get() const
Definition: SkRefCnt.h:303
SkSamplingOptions sampling
Definition: SkRecords.h:337

◆ onGetName()

const char * DrawBitmapAABench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 31 of file DrawBitmapAABench.cpp.

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

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