Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
RandomPathBench Class Reference
Inheritance diagram for RandomPathBench:
Benchmark SkRefCnt SkRefCntBase PathCopyBench PathCreateBench PathEqualityBench PathTransformBench SkBench_AddPathTest

Public Member Functions

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

void createData (int minVerbs, int maxVerbs, bool allowMoves=true, SkRect *bounds=nullptr)
 
void restartMakingPaths ()
 
void makePath (SkPath *path)
 
void finishedMakingPaths ()
 
- 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 306 of file PathBench.cpp.

Member Function Documentation

◆ createData()

void RandomPathBench::createData ( int  minVerbs,
int  maxVerbs,
bool  allowMoves = true,
SkRect bounds = nullptr 
)
inlineprotected

Definition at line 313 of file PathBench.cpp.

316 {
317 SkRect tempBounds;
318 if (nullptr == bounds) {
319 tempBounds.setXYWH(0, 0, SK_Scalar1, SK_Scalar1);
320 bounds = &tempBounds;
321 }
322 fVerbCnts.reset(kNumVerbCnts);
323 for (int i = 0; i < kNumVerbCnts; ++i) {
324 fVerbCnts[i] = fRandom.nextRangeU(minVerbs, maxVerbs + 1);
325 }
326 fVerbs.reset(kNumVerbs);
327 for (int i = 0; i < kNumVerbs; ++i) {
328 do {
329 fVerbs[i] = static_cast<SkPath::Verb>(fRandom.nextULessThan(SkPath::kDone_Verb));
330 } while (!allowMoves && SkPath::kMove_Verb == fVerbs[i]);
331 }
332 fPoints.reset(kNumPoints);
333 for (int i = 0; i < kNumPoints; ++i) {
334 fPoints[i].set(fRandom.nextRangeScalar(bounds->fLeft, bounds->fRight),
335 fRandom.nextRangeScalar(bounds->fTop, bounds->fBottom));
336 }
337 this->restartMakingPaths();
338 }
#define SK_Scalar1
Definition SkScalar.h:18
void restartMakingPaths()
@ kMove_Verb
Definition SkPath.h:1458
@ kDone_Verb
Definition SkPath.h:1464
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
Definition SkRandom.h:106
uint32_t nextULessThan(uint32_t count)
Definition SkRandom.h:93
uint32_t nextRangeU(uint32_t min, uint32_t max)
Definition SkRandom.h:80
void reset(size_t count=0)
Optional< SkRect > bounds
Definition SkRecords.h:189
void setXYWH(float x, float y, float width, float height)
Definition SkRect.h:931

◆ finishedMakingPaths()

void RandomPathBench::finishedMakingPaths ( )
inlineprotected

Definition at line 384 of file PathBench.cpp.

384 {
385 fVerbCnts.reset(0);
386 fVerbs.reset(0);
387 fPoints.reset(0);
388 }

◆ isSuitableFor()

bool RandomPathBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 308 of file PathBench.cpp.

308 {
310 }
const char * backend

◆ makePath()

void RandomPathBench::makePath ( SkPath path)
inlineprotected

Definition at line 346 of file PathBench.cpp.

346 {
347 int vCount = fVerbCnts[(fCurrPath++) & (kNumVerbCnts - 1)];
348 for (int v = 0; v < vCount; ++v) {
349 int verb = fVerbs[(fCurrVerb++) & (kNumVerbs - 1)];
350 switch (verb) {
352 path->moveTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
353 break;
355 path->lineTo(fPoints[(fCurrPoint++) & (kNumPoints - 1)]);
356 break;
358 path->quadTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
359 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)]);
360 fCurrPoint += 2;
361 break;
363 path->conicTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
364 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)],
366 fCurrPoint += 2;
367 break;
369 path->cubicTo(fPoints[(fCurrPoint + 0) & (kNumPoints - 1)],
370 fPoints[(fCurrPoint + 1) & (kNumPoints - 1)],
371 fPoints[(fCurrPoint + 2) & (kNumPoints - 1)]);
372 fCurrPoint += 3;
373 break;
375 path->close();
376 break;
377 default:
378 SkDEBUGFAIL("Unexpected path verb");
379 break;
380 }
381 }
382 }
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118
#define SK_ScalarHalf
Definition SkScalar.h:19
@ kClose_Verb
Definition SkPath.h:1463
@ kConic_Verb
Definition SkPath.h:1461
@ kCubic_Verb
Definition SkPath.h:1462
@ kQuad_Verb
Definition SkPath.h:1460
@ kLine_Verb
Definition SkPath.h:1459
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

◆ restartMakingPaths()

void RandomPathBench::restartMakingPaths ( )
inlineprotected

Definition at line 340 of file PathBench.cpp.

340 {
341 fCurrPath = 0;
342 fCurrVerb = 0;
343 fCurrPoint = 0;
344 }

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