Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Protected Member Functions | Protected Attributes | List of all members
skgpu::graphite::IntersectionTreeBench Class Referenceabstract
Inheritance diagram for skgpu::graphite::IntersectionTreeBench:
Benchmark SkRefCnt SkRefCntBase skgpu::graphite::FileIntersectionBench skgpu::graphite::RandomIntersectionBench

Protected Member Functions

const char * onGetName () final
 
bool isSuitableFor (Backend backend) override
 
void onDelayedSetup () final
 
virtual void gatherRects (TArray< SkRect > *rects)=0
 
void onDraw (int loops, SkCanvas *) final
 
void doBench ()
 
- Protected Member Functions inherited from Benchmark
void setUnits (int units)
 
virtual void setupPaint (SkPaint *paint)
 
virtual const char * onGetUniqueName ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
virtual SkISize onGetSize ()
 

Protected Attributes

SkString fName
 
SkArenaAlloc fAlignedAllocator {0}
 
int fRectCount
 
RectfRects
 
RectfRectBufferA
 
RectfRectBufferB
 
int fNumTrees = 0
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 
- Public Member Functions inherited from Benchmark
 Benchmark ()
 
const char * getName ()
 
const char * getUniqueName ()
 
SkISize getSize ()
 
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
 

Detailed Description

Definition at line 27 of file IntersectionTreeBench.cpp.

Member Function Documentation

◆ doBench()

void skgpu::graphite::IntersectionTreeBench::doBench ( )
inlineprotected

Definition at line 55 of file IntersectionTreeBench.cpp.

55 {
56 Rect* rects = fRects;
57 Rect* collided = fRectBufferA;
58 int rectCount = fRectCount;
59 fNumTrees = 0;
60 while (rectCount > 0) {
61 IntersectionTree intersectionTree;
62 int collidedCount = 0;
63 for (int i = 0; i < rectCount; ++i) {
64 if (!intersectionTree.add(rects[i])) {
65 collided[collidedCount++] = rects[i];
66 }
67 }
68 std::swap(rects, collided);
69 if (collided == fRects) {
70 collided = fRectBufferB;
71 }
72 rectCount = collidedCount;
73 ++fNumTrees;
74 }
75 }
TRect< Scalar > Rect
Definition rect.h:746

◆ gatherRects()

virtual void skgpu::graphite::IntersectionTreeBench::gatherRects ( TArray< SkRect > *  rects)
protectedpure virtual

◆ isSuitableFor()

bool skgpu::graphite::IntersectionTreeBench::isSuitableFor ( Backend  backend)
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 31 of file IntersectionTreeBench.cpp.

31 {
33 }
const char * backend

◆ onDelayedSetup()

void skgpu::graphite::IntersectionTreeBench::onDelayedSetup ( )
inlinefinalprotectedvirtual

Reimplemented from Benchmark.

Definition at line 35 of file IntersectionTreeBench.cpp.

35 {
36 TArray<SkRect> rects;
37 this->gatherRects(&rects);
38 fRectCount = rects.size();
40 for (int i = 0; i < fRectCount; ++i) {
41 fRects[i] = rects[i];
42 }
45 }
T * makeArray(size_t count)
virtual void gatherRects(TArray< SkRect > *rects)=0
int size() const
Definition SkTArray.h:416

◆ onDraw()

void skgpu::graphite::IntersectionTreeBench::onDraw ( int  loops,
SkCanvas  
)
inlinefinalprotectedvirtual

Implements Benchmark.

Definition at line 49 of file IntersectionTreeBench.cpp.

49 {
50 for (int i = 0; i < loops; ++i) {
51 this->doBench();
52 }
53 }

◆ onGetName()

const char * skgpu::graphite::IntersectionTreeBench::onGetName ( )
inlinefinalprotectedvirtual

Implements Benchmark.

Definition at line 29 of file IntersectionTreeBench.cpp.

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

Member Data Documentation

◆ fAlignedAllocator

SkArenaAlloc skgpu::graphite::IntersectionTreeBench::fAlignedAllocator {0}
protected

Definition at line 78 of file IntersectionTreeBench.cpp.

78{0};

◆ fName

SkString skgpu::graphite::IntersectionTreeBench::fName
protected

Definition at line 77 of file IntersectionTreeBench.cpp.

◆ fNumTrees

int skgpu::graphite::IntersectionTreeBench::fNumTrees = 0
protected

Definition at line 83 of file IntersectionTreeBench.cpp.

◆ fRectBufferA

Rect* skgpu::graphite::IntersectionTreeBench::fRectBufferA
protected

Definition at line 81 of file IntersectionTreeBench.cpp.

◆ fRectBufferB

Rect* skgpu::graphite::IntersectionTreeBench::fRectBufferB
protected

Definition at line 82 of file IntersectionTreeBench.cpp.

◆ fRectCount

int skgpu::graphite::IntersectionTreeBench::fRectCount
protected

Definition at line 79 of file IntersectionTreeBench.cpp.

◆ fRects

Rect* skgpu::graphite::IntersectionTreeBench::fRects
protected

Definition at line 80 of file IntersectionTreeBench.cpp.


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