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

Public Types

enum  { W = 1024 , H = 768 }
 
typedef bool(* Proc) (SkRegion &a, SkRegion &b)
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

SkIRect randrect (SkRandom &rand)
 
 RegionBench (int count, Proc proc, const char name[])
 
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
 

Public Attributes

SkRegion fA
 
SkRegion fB
 
Proc fProc
 
SkString fName
 

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 ()
 

Detailed Description

Definition at line 69 of file RegionBench.cpp.

Member Typedef Documentation

◆ Proc

typedef bool(* RegionBench::Proc) (SkRegion &a, SkRegion &b)

Definition at line 71 of file RegionBench.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator

Definition at line 77 of file RegionBench.cpp.

77 {
78 W = 1024,
79 H = 768,
80 };
Definition: SkMD5.cpp:130

Constructor & Destructor Documentation

◆ RegionBench()

RegionBench::RegionBench ( int  count,
Proc  proc,
const char  name[] 
)
inline

Definition at line 90 of file RegionBench.cpp.

90 {
91 fProc = proc;
92 fName.printf("region_%s_%d", name, count);
93
94 SkRandom rand;
95 for (int i = 0; i < count; i++) {
98 }
99 }
int count
Definition: FontMgrTest.cpp:50
SkString fName
Definition: RegionBench.cpp:75
SkIRect randrect(SkRandom &rand)
Definition: RegionBench.cpp:82
SkRegion fB
Definition: RegionBench.cpp:73
SkRegion fA
Definition: RegionBench.cpp:73
@ kXOR_Op
target exclusive or with operand
Definition: SkRegion.h:370
bool op(const SkIRect &rect, Op op)
Definition: SkRegion.h:384
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

Member Function Documentation

◆ isSuitableFor()

bool RegionBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 101 of file RegionBench.cpp.

101 {
103 }
const char * backend

◆ onDraw()

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

Implements Benchmark.

Definition at line 108 of file RegionBench.cpp.

108 {
109 Proc proc = fProc;
110 for (int i = 0; i < loops; ++i) {
111 proc(fA, fB);
112 }
113 }
bool(* Proc)(SkRegion &a, SkRegion &b)
Definition: RegionBench.cpp:71

◆ onGetName()

const char * RegionBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 106 of file RegionBench.cpp.

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

◆ randrect()

SkIRect RegionBench::randrect ( SkRandom rand)
inline

Definition at line 82 of file RegionBench.cpp.

82 {
83 int x = rand.nextU() % W;
84 int y = rand.nextU() % H;
85 int w = rand.nextU() % W;
86 int h = rand.nextU() % H;
87 return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1);
88 }
uint32_t nextU()
Definition: SkRandom.h:42
double y
double x
SkScalar w
SkScalar h
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
Definition: SkRect.h:104

Member Data Documentation

◆ fA

SkRegion RegionBench::fA

Definition at line 73 of file RegionBench.cpp.

◆ fB

SkRegion RegionBench::fB

Definition at line 73 of file RegionBench.cpp.

◆ fName

SkString RegionBench::fName

Definition at line 75 of file RegionBench.cpp.

◆ fProc

Proc RegionBench::fProc

Definition at line 74 of file RegionBench.cpp.


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