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

Public Member Functions

 BigPathBench (Align align, bool round)
 
- 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
 
SkISize onGetSize () 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 23 of file BigPathBench.cpp.

Constructor & Destructor Documentation

◆ BigPathBench()

BigPathBench::BigPathBench ( Align  align,
bool  round 
)
inline

Definition at line 30 of file BigPathBench.cpp.

30 : fAlign(align), fRound(round) {
31 fName.printf("bigpath_%s", gAlignName[fAlign]);
32 if (round) {
33 fName.append("_round");
34 }
35 }
const char * gAlignName[]
static void round(SkPoint *p)
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
void append(const char text[])
Definition: SkString.h:203

Member Function Documentation

◆ onDelayedSetup()

void BigPathBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 46 of file BigPathBench.cpp.

46{ fPath = BenchUtils::make_big_path(); }
SkPath make_big_path()
Definition: BigPath.cpp:19

◆ onDraw()

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

Implements Benchmark.

Definition at line 48 of file BigPathBench.cpp.

48 {
50 paint.setAntiAlias(true);
52 paint.setStrokeWidth(2);
53 if (fRound) {
54 paint.setStrokeJoin(SkPaint::kRound_Join);
55 }
56 this->setupPaint(&paint);
57
58 const SkRect r = fPath.getBounds();
59 switch (fAlign) {
60 case kLeft_Align:
61 canvas->translate(-r.left(), 0);
62 break;
63 case kMiddle_Align:
64 break;
65 case kRight_Align:
66 canvas->translate(640 - r.right(), 0);
67 break;
68 }
69
70 for (int i = 0; i < loops; i++) {
71 canvas->drawPath(fPath, paint);
72 }
73 }
@ kMiddle_Align
@ kRight_Align
@ kLeft_Align
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kRound_Join
adds circle
Definition: SkPaint.h:360
const SkRect & getBounds() const
Definition: SkPath.cpp:430
const Paint & paint
Definition: color_source.cc:38
constexpr float left() const
Definition: SkRect.h:734
constexpr float right() const
Definition: SkRect.h:748

◆ onGetName()

const char * BigPathBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 38 of file BigPathBench.cpp.

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

◆ onGetSize()

SkISize BigPathBench::onGetSize ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 42 of file BigPathBench.cpp.

42 {
43 return SkISize::Make(640, 100);
44 }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

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