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

Public Member Functions

 RTreeQueryBench (const char *name, MakeRectProc proc)
 
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 *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 ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 59 of file RTreeBench.cpp.

Constructor & Destructor Documentation

◆ RTreeQueryBench()

RTreeQueryBench::RTreeQueryBench ( const char *  name,
MakeRectProc  proc 
)
inline

Definition at line 61 of file RTreeBench.cpp.

61 : fProc(proc) {
62 fName.printf("rtree_%s_query", name);
63 }
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 RTreeQueryBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 65 of file RTreeBench.cpp.

65 {
67 }
const char * backend

◆ onDelayedSetup()

void RTreeQueryBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 72 of file RTreeBench.cpp.

72 {
73 SkRandom rand;
75 for (int i = 0; i < NUM_QUERY_RECTS; ++i) {
76 rects[i] = fProc(rand, i, NUM_QUERY_RECTS);
77 }
78 fTree.insert(rects.data(), NUM_QUERY_RECTS);
79 }
static const int NUM_QUERY_RECTS
Definition: RTreeBench.cpp:20
void insert(const SkRect[], int N) override
Definition: SkRTree.cpp:15

◆ onDraw()

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

Implements Benchmark.

Definition at line 81 of file RTreeBench.cpp.

81 {
82 SkRandom rand;
83 for (int i = 0; i < loops; ++i) {
84 std::vector<int> hits;
85 SkRect query;
86 query.fLeft = rand.nextRangeF(0, GENERATE_EXTENTS);
87 query.fTop = rand.nextRangeF(0, GENERATE_EXTENTS);
88 query.fRight = query.fLeft + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/2);
89 query.fBottom = query.fTop + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/2);
90 fTree.search(query, &hits);
91 }
92 }
static const SkScalar GENERATE_EXTENTS
Definition: RTreeBench.cpp:18
void search(const SkRect &query, std::vector< int > *results) const override
Definition: SkRTree.cpp:147
float nextRangeF(float min, float max)
Definition: SkRandom.h:64
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ onGetName()

const char * RTreeQueryBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 69 of file RTreeBench.cpp.

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

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