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

Public Types

enum  AddType {
  kAdd_AddType , kAddTrans_AddType , kAddMatrix_AddType , kReverseAdd_AddType ,
  kReversePathTo_AddType
}
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 SkBench_AddPathTest (AddType type)
 
- Public Member Functions inherited from RandomPathBench
bool isSuitableFor (Backend backend) override
 
- 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 *) override
 
- Protected Member Functions inherited from RandomPathBench
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 ()
 

Detailed Description

Definition at line 560 of file PathBench.cpp.

Member Enumeration Documentation

◆ AddType

Enumerator
kAdd_AddType 
kAddTrans_AddType 
kAddMatrix_AddType 
kReverseAdd_AddType 
kReversePathTo_AddType 

Definition at line 562 of file PathBench.cpp.

Constructor & Destructor Documentation

◆ SkBench_AddPathTest()

SkBench_AddPathTest::SkBench_AddPathTest ( AddType  type)
inline

Definition at line 570 of file PathBench.cpp.

570 : fType(type) {
571 fMatrix.setRotate(60 * SK_Scalar1);
572 }
#define SK_Scalar1
Definition: SkScalar.h:18
GLenum type
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition: SkMatrix.cpp:452

Member Function Documentation

◆ onDelayedSetup()

void SkBench_AddPathTest::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 593 of file PathBench.cpp.

593 {
594 // reversePathTo assumes a single contour path.
595 bool allowMoves = kReversePathTo_AddType != fType;
596 this->createData(10, 100, allowMoves);
597 fPaths0.reset(kPathCnt);
598 fPaths1.reset(kPathCnt);
599 for (int i = 0; i < kPathCnt; ++i) {
600 this->makePath(&fPaths0[i]);
601 this->makePath(&fPaths1[i]);
602 }
603 this->finishedMakingPaths();
604 }
void makePath(SkPath *path)
Definition: PathBench.cpp:346
void createData(int minVerbs, int maxVerbs, bool allowMoves=true, SkRect *bounds=nullptr)
Definition: PathBench.cpp:313
void finishedMakingPaths()
Definition: PathBench.cpp:384
void reset(size_t count=0)
Definition: SkTemplates.h:123

◆ onDraw()

void SkBench_AddPathTest::onDraw ( int  loops,
SkCanvas  
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 606 of file PathBench.cpp.

606 {
607 switch (fType) {
608 case kAdd_AddType:
609 for (int i = 0; i < loops; ++i) {
610 int idx = i & (kPathCnt - 1);
611 SkPath result = fPaths0[idx];
612 result.addPath(fPaths1[idx]);
613 }
614 break;
616 for (int i = 0; i < loops; ++i) {
617 int idx = i & (kPathCnt - 1);
618 SkPath result = fPaths0[idx];
619 result.addPath(fPaths1[idx], 2 * SK_Scalar1, 5 * SK_Scalar1);
620 }
621 break;
623 for (int i = 0; i < loops; ++i) {
624 int idx = i & (kPathCnt - 1);
625 SkPath result = fPaths0[idx];
626 result.addPath(fPaths1[idx], fMatrix);
627 }
628 break;
630 for (int i = 0; i < loops; ++i) {
631 int idx = i & (kPathCnt - 1);
632 SkPath result = fPaths0[idx];
633 result.reverseAddPath(fPaths1[idx]);
634 }
635 break;
637 for (int i = 0; i < loops; ++i) {
638 int idx = i & (kPathCnt - 1);
639 SkPath result = fPaths0[idx];
640 result.reversePathTo(fPaths1[idx]);
641 }
642 break;
643 }
644 }
Definition: SkPath.h:59
GAsyncResult * result

◆ onGetName()

const char * SkBench_AddPathTest::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 575 of file PathBench.cpp.

575 {
576 switch (fType) {
577 case kAdd_AddType:
578 return "path_add_path";
580 return "path_add_path_trans";
582 return "path_add_path_matrix";
584 return "path_reverse_add_path";
586 return "path_reverse_path_to";
587 default:
588 SkDEBUGFAIL("Bad add type");
589 return "";
590 }
591 }
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118

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