Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
RTreeBench.cpp File Reference
#include "bench/Benchmark.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkString.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkRandom.h"
#include "src/core/SkRTree.h"

Go to the source code of this file.

Classes

class  RTreeBuildBench
 
class  RTreeQueryBench
 

Typedefs

typedef SkRect(* MakeRectProc) (SkRandom &, int, int)
 

Functions

static SkRect make_XYordered_rects (SkRandom &rand, int index, int numRects)
 
static SkRect make_YXordered_rects (SkRandom &rand, int index, int numRects)
 
static SkRect make_random_rects (SkRandom &rand, int index, int numRects)
 
static SkRect make_concentric_rects (SkRandom &, int index, int numRects)
 
 DEF_BENCH (return new RTreeBuildBench("XY", &make_XYordered_rects))
 
 DEF_BENCH (return new RTreeBuildBench("YX", &make_YXordered_rects))
 
 DEF_BENCH (return new RTreeBuildBench("random", &make_random_rects))
 
 DEF_BENCH (return new RTreeBuildBench("concentric", &make_concentric_rects))
 

Variables

static const SkScalar GENERATE_EXTENTS = 1000.0f
 
static const int NUM_BUILD_RECTS = 500
 
static const int NUM_QUERY_RECTS = 5000
 
static const int GRID_WIDTH = 100
 

Typedef Documentation

◆ MakeRectProc

typedef SkRect(* MakeRectProc) (SkRandom &, int, int)

Definition at line 23 of file RTreeBench.cpp.

Function Documentation

◆ DEF_BENCH() [1/4]

DEF_BENCH ( return new   RTreeBuildBench"concentric", &make_concentric_rects)

◆ DEF_BENCH() [2/4]

DEF_BENCH ( return new   RTreeBuildBench"random", &make_random_rects)

◆ DEF_BENCH() [3/4]

DEF_BENCH ( return new   RTreeBuildBench"XY", &make_XYordered_rects)

◆ DEF_BENCH() [4/4]

DEF_BENCH ( return new   RTreeBuildBench"YX", &make_YXordered_rects)

◆ make_concentric_rects()

static SkRect make_concentric_rects ( SkRandom ,
int  index,
int  numRects 
)
inlinestatic

Definition at line 126 of file RTreeBench.cpp.

126 {
127 return SkRect::MakeWH(SkIntToScalar(index+1), SkIntToScalar(index+1));
128}
#define SkIntToScalar(x)
Definition SkScalar.h:57
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

◆ make_random_rects()

static SkRect make_random_rects ( SkRandom rand,
int  index,
int  numRects 
)
inlinestatic

Definition at line 117 of file RTreeBench.cpp.

117 {
118 SkRect out;
119 out.fLeft = rand.nextRangeF(0, GENERATE_EXTENTS);
120 out.fTop = rand.nextRangeF(0, GENERATE_EXTENTS);
121 out.fRight = out.fLeft + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/5);
122 out.fBottom = out.fTop + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/5);
123 return out;
124}
static const SkScalar GENERATE_EXTENTS
float nextRangeF(float min, float max)
Definition SkRandom.h:64

◆ make_XYordered_rects()

static SkRect make_XYordered_rects ( SkRandom rand,
int  index,
int  numRects 
)
inlinestatic

Definition at line 100 of file RTreeBench.cpp.

100 {
101 SkRect out;
102 out.fLeft = SkIntToScalar(index % GRID_WIDTH);
103 out.fTop = SkIntToScalar(index / GRID_WIDTH);
104 out.fRight = out.fLeft + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/3);
105 out.fBottom = out.fTop + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/3);
106 return out;
107}
static const int GRID_WIDTH

◆ make_YXordered_rects()

static SkRect make_YXordered_rects ( SkRandom rand,
int  index,
int  numRects 
)
inlinestatic

Definition at line 108 of file RTreeBench.cpp.

108 {
109 SkRect out;
110 out.fLeft = SkIntToScalar(index / GRID_WIDTH);
111 out.fTop = SkIntToScalar(index % GRID_WIDTH);
112 out.fRight = out.fLeft + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/3);
113 out.fBottom = out.fTop + 1 + rand.nextRangeF(0, GENERATE_EXTENTS/3);
114 return out;
115}

Variable Documentation

◆ GENERATE_EXTENTS

const SkScalar GENERATE_EXTENTS = 1000.0f
static

Definition at line 18 of file RTreeBench.cpp.

◆ GRID_WIDTH

const int GRID_WIDTH = 100
static

Definition at line 21 of file RTreeBench.cpp.

◆ NUM_BUILD_RECTS

const int NUM_BUILD_RECTS = 500
static

Definition at line 19 of file RTreeBench.cpp.

◆ NUM_QUERY_RECTS

const int NUM_QUERY_RECTS = 5000
static

Definition at line 20 of file RTreeBench.cpp.