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

Public Types

enum  { W = 200 , H = 200 , COUNT = 10 }
 
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, int i)
 
 RegionContainBench (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 *) 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 18 of file RegionContainBench.cpp.

Member Typedef Documentation

◆ Proc

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

Definition at line 20 of file RegionContainBench.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
COUNT 

Definition at line 25 of file RegionContainBench.cpp.

25 {
26 W = 200,
27 H = 200,
28 COUNT = 10,
29 };
Definition: SkMD5.cpp:130

Constructor & Destructor Documentation

◆ RegionContainBench()

RegionContainBench::RegionContainBench ( Proc  proc,
const char  name[] 
)
inline

Definition at line 36 of file RegionContainBench.cpp.

36 {
37 fProc = proc;
38 fName.printf("region_contains_%s", name);
39
40 SkRandom rand;
41 for (int i = 0; i < COUNT; i++) {
43 }
44
45 fB.setRect({0, 0, H, W});
46 }
SkIRect randrect(SkRandom &rand, int i)
@ kXOR_Op
target exclusive or with operand
Definition: SkRegion.h:370
bool op(const SkIRect &rect, Op op)
Definition: SkRegion.h:384
bool setRect(const SkIRect &rect)
Definition: SkRegion.cpp:192
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 RegionContainBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 48 of file RegionContainBench.cpp.

48 {
50 }
const char * backend

◆ onDraw()

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

Implements Benchmark.

Definition at line 55 of file RegionContainBench.cpp.

55 {
56 Proc proc = fProc;
57
58 for (int i = 0; i < loops; ++i) {
59 proc(fA, fB);
60 }
61 }
bool(* Proc)(SkRegion &a, SkRegion &b)

◆ onGetName()

const char * RegionContainBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 53 of file RegionContainBench.cpp.

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

◆ randrect()

SkIRect RegionContainBench::randrect ( SkRandom rand,
int  i 
)
inline

Definition at line 31 of file RegionContainBench.cpp.

31 {
32 int w = rand.nextU() % W;
33 return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT);
34 }
uint32_t nextU()
Definition: SkRandom.h:42
SkScalar w
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 RegionContainBench::fA

Definition at line 21 of file RegionContainBench.cpp.

◆ fB

SkRegion RegionContainBench::fB

Definition at line 21 of file RegionContainBench.cpp.

◆ fName

SkString RegionContainBench::fName

Definition at line 23 of file RegionContainBench.cpp.

◆ fProc

Proc RegionContainBench::fProc

Definition at line 22 of file RegionContainBench.cpp.


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