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

Public Member Functions

 DrawPathBench (bool drawCoverage)
 
- 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

Definition at line 18 of file CoverageBench.cpp.

Constructor & Destructor Documentation

◆ DrawPathBench()

DrawPathBench::DrawPathBench ( bool  drawCoverage)
inline

Definition at line 27 of file CoverageBench.cpp.

27 : fDrawCoverage(drawCoverage) {
28 fName.printf("draw_coverage_%s", drawCoverage ? "true" : "false");
29 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534

Member Function Documentation

◆ onDelayedSetup()

void DrawPathBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 36 of file CoverageBench.cpp.

36 {
37 fPaint.setAntiAlias(true);
38
39 fPath.moveTo(0, 0);
40 fPath.quadTo(500, 0, 500, 500);
41 fPath.quadTo(250, 0, 0, 500);
42
43 fPixmap.alloc(SkImageInfo::MakeA8(500, 500));
44 if (!fDrawCoverage) {
45 // drawPathCoverage() goes out of its way to work fine with an uninitialized
46 // dst buffer, even in "SrcOver" mode, but ordinary drawing sure doesn't.
47 fPixmap.erase(0);
48 }
49
50 fRC.setRect(fPath.getBounds().round());
51
52 fDraw.fDst = fPixmap;
53 fDraw.fCTM = &SkMatrix::I();
54 fDraw.fRC = &fRC;
55 }
void alloc(const SkImageInfo &)
const SkRasterClip * fRC
Definition: SkDrawBase.h:156
SkPixmap fDst
Definition: SkDrawBase.h:153
const SkMatrix * fCTM
Definition: SkDrawBase.h:155
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: SkPath.cpp:746
const SkRect & getBounds() const
Definition: SkPath.cpp:430
bool erase(SkColor color, const SkIRect &subset) const
Definition: SkPixmap.cpp:742
bool setRect(const SkIRect &)
static SkImageInfo MakeA8(int width, int height)
void round(SkIRect *dst) const
Definition: SkRect.h:1228

◆ onDraw()

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

Implements Benchmark.

Definition at line 57 of file CoverageBench.cpp.

57 {
58 if (fDrawCoverage) {
59 for (int i = 0; i < loops; ++i) {
60 fDraw.drawPathCoverage(fPath, fPaint);
61 }
62 } else {
63 for (int i = 0; i < loops; ++i) {
64 fDraw.drawPath(fPath, fPaint);
65 }
66 }
67 }
void drawPath(const SkPath &path, const SkPaint &paint, const SkMatrix *prePathMatrix=nullptr, bool pathIsMutable=false) const
Definition: SkDrawBase.h:60
void drawPathCoverage(const SkPath &src, const SkPaint &paint, SkBlitter *customBlitter=nullptr) const
Definition: SkDrawBase.h:71

◆ onGetName()

const char * DrawPathBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 32 of file CoverageBench.cpp.

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

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