Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
PathBuilderBench Class Reference
Inheritance diagram for PathBuilderBench:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 PathBuilderBench (MakeType mt, bool reserve)
 
bool isSuitableFor (Backend backend) override
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
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
 
SkPath build ()
 
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 * onGetUniqueName ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
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 147 of file PathOpsBench.cpp.

Constructor & Destructor Documentation

◆ PathBuilderBench()

PathBuilderBench::PathBuilderBench ( MakeType  mt,
bool  reserve 
)
inline

Definition at line 156 of file PathOpsBench.cpp.

156 : fMakeType(mt), fUseReserve(reserve) {
157 const char* typenames[] = { "path", "snapshot", "detach", "arrays" };
158
159 fName.printf("makepath_%s_%s", typenames[(int)mt], reserve ? "reserve" : "noreserve");
160 }
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:534

Member Function Documentation

◆ build()

SkPath PathBuilderBench::build ( )
inlineprotected

Definition at line 175 of file PathOpsBench.cpp.

175 {
176 switch (fMakeType) {
178 case MakeType::kDetach: {
180 run_builder(b, fUseReserve, N);
181 return MakeType::kSnapshot == fMakeType ? b.snapshot() : b.detach();
182 }
183 case MakeType::kPath: {
184 SkPath p;
185 run_builder(p, fUseReserve, N);
186 return p;
187 }
188 case MakeType::kArray: {
189 // ArrayPath<N*12> arrays;
190 // run_builder(arrays, false, N);
191 return SkPath::Make(fArrays.fPts, fArrays.fPIndex,
192 fArrays.fVbs, fArrays.fVIndex,
193 nullptr, 0, SkPathFillType::kWinding);
194 }
195 }
196 return SkPath();
197 }
void run_builder(T &b, bool useReserve, int N)
static SkPath Make(const SkPoint[], int pointCount, const uint8_t[], int verbCount, const SkScalar[], int conicWeightCount, SkPathFillType, bool isVolatile=false)
Definition SkPath.cpp:3501
static bool b

◆ isSuitableFor()

bool PathBuilderBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 162 of file PathOpsBench.cpp.

162 {
164 }
const char * backend

◆ onDelayedSetup()

void PathBuilderBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 171 of file PathOpsBench.cpp.

171 {
172 run_builder(fArrays, false, N);
173 }

◆ onDraw()

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

Implements Benchmark.

Definition at line 199 of file PathOpsBench.cpp.

199 {
200 for (int i = 0; i < loops; i++) {
201 for (int j = 0; j < 100; ++j) {
202 SkPath result = this->build();
203 // force bounds calc as part of the test
204 if (!result.getBounds().isFinite()) {
205 SkDebugf("should never get here!\n");
206 return;
207 }
208 }
209 }
210 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkRect & getBounds() const
Definition SkPath.cpp:420
GAsyncResult * result
bool isFinite() const
Definition SkRect.h:711

◆ onGetName()

const char * PathBuilderBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 167 of file PathOpsBench.cpp.

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

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