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

Public Member Functions

 BezierBench (SkPaint::Cap c, SkPaint::Join j, SkScalar w, DrawProc proc)
 
- 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 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 47 of file BezierBench.cpp.

Constructor & Destructor Documentation

◆ BezierBench()

BezierBench::BezierBench ( SkPaint::Cap  c,
SkPaint::Join  j,
SkScalar  w,
DrawProc  proc 
)
inline

Definition at line 55 of file BezierBench.cpp.

55 {
56 static const char* gCapName[] = {
57 "butt", "round", "square"
58 };
59 static const char* gJoinName[] = {
60 "miter", "round", "bevel"
61 };
62
63 fCap = c;
64 fJoin = j;
65 fProc = proc;
66 fWidth = SkIntToScalar(w);
67 fName.printf("draw_stroke_bezier_%s_%s_%s_%g", proc(nullptr, 0), gCapName[c], gJoinName[j], w);
68
69 fRec.fQuad.moveTo(20, 20);
70 fRec.fQuad.quadTo(60, 20, 60, 60);
71 fRec.fQuad.quadTo(20, 60, 20, 100);
72 fRec.fCubic.moveTo(20, 20);
73 fRec.fCubic.cubicTo(40, 20, 60, 40, 60, 60);
74 fRec.fCubic.cubicTo(40, 60, 20, 80, 20, 100);
75 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: SkPath.cpp:746
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: SkPath.cpp:799
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
SkScalar w
SkPath fCubic
Definition: BezierBench.cpp:18
SkPath fQuad
Definition: BezierBench.cpp:17

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 82 of file BezierBench.cpp.

82 {
83 fRec.fCanvas = canvas;
84 this->setupPaint(&fRec.fPaint);
86 fRec.fPaint.setStrokeCap(fCap);
87 fRec.fPaint.setStrokeJoin(fJoin);
88 fRec.fPaint.setStrokeWidth(fWidth);
89 fProc(&fRec, loops);
90 }
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setStrokeCap(Cap cap)
Definition: SkPaint.cpp:179
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
void setStrokeJoin(Join join)
Definition: SkPaint.cpp:189
void setStrokeWidth(SkScalar width)
Definition: SkPaint.cpp:159
SkCanvas * fCanvas
Definition: BezierBench.cpp:15
SkPaint fPaint
Definition: BezierBench.cpp:16

◆ onGetName()

const char * BezierBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 78 of file BezierBench.cpp.

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

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