Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TriangulatorBenchmark Class Referenceabstract
Inheritance diagram for TriangulatorBenchmark:
Benchmark GrEagerVertexAllocator SkRefCnt SkRefCntBase PathToTrianglesBench TriangulateInnerFanBench

Public Member Functions

 TriangulatorBenchmark (const char *name)
 
const char * onGetName () override
 
bool isSuitableFor (Backend backend) final
 
- 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 Member Functions inherited from GrEagerVertexAllocator
virtual void * lock (size_t stride, int eagerCount)=0
 
virtual void unlock (int actualCount)=0
 
virtual ~GrEagerVertexAllocator ()
 
skgpu::VertexWriter lockWriter (size_t stride, int eagerCount)
 

Protected Member Functions

void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *) final
 
void * lock (size_t stride, int eagerCount) override
 
void unlock (int) override
 
virtual void doLoop ()=0
 
- 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 ()
 

Protected Attributes

SkString fName
 
TArray< SkPathfPaths
 
AutoTMalloc< char > fVertexData
 
size_t fVertexAllocSize = 0
 
SkArenaAllocWithReset fArena {GrTriangulator::kArenaDefaultChunkSize}
 

Additional Inherited Members

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

Detailed Description

Definition at line 30 of file TriangulatorBench.cpp.

Constructor & Destructor Documentation

◆ TriangulatorBenchmark()

TriangulatorBenchmark::TriangulatorBenchmark ( const char *  name)
inline

Definition at line 32 of file TriangulatorBench.cpp.

32 {
33 fName.printf("triangulator_%s", name);
34 }
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

◆ doLoop()

virtual void TriangulatorBenchmark::doLoop ( )
protectedpure virtual

◆ isSuitableFor()

bool TriangulatorBenchmark::isSuitableFor ( Backend  backend)
inlinefinalvirtual

Reimplemented from Benchmark.

Definition at line 37 of file TriangulatorBench.cpp.

const char * backend

◆ lock()

void * TriangulatorBenchmark::lock ( size_t  stride,
int  eagerCount 
)
inlineoverrideprotectedvirtual

Implements GrEagerVertexAllocator.

Definition at line 79 of file TriangulatorBench.cpp.

79 {
80 size_t allocSize = eagerCount * stride;
81 if (allocSize > fVertexAllocSize) {
82 fVertexData.reset(allocSize);
83 }
84 return fVertexData;
85 }
AutoTMalloc< char > fVertexData
T * reset(size_t count=0)
Definition: SkTemplates.h:296

◆ onDelayedSetup()

void TriangulatorBenchmark::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 40 of file TriangulatorBench.cpp.

40 {
41 for (int i = 0; i < kNumTigerPaths; ++i) {
43 const std::vector<SkPoint>& pts = kTigerPaths[i].fPoints;
44 int ptsIdx = 0;
45 for (const char* v = kTigerPaths[i].fVerbs; *v; ++v) {
46 switch (*v) {
47 case 'm':
48 path.moveTo(pts[ptsIdx]);
49 ++ptsIdx;
50 break;
51 case 'l':
52 path.lineTo(pts[ptsIdx]);
53 ++ptsIdx;
54 break;
55 case 'q':
56 path.quadTo(pts[ptsIdx], pts[ptsIdx + 1]);
57 ptsIdx += 2;
58 break;
59 case 'c':
60 path.cubicTo(pts[ptsIdx], pts[ptsIdx + 1], pts[ptsIdx + 2]);
61 ptsIdx += 3;
62 break;
63 case 'z':
64 path.close();
65 break;
66 }
67 }
68 SkASSERT(ptsIdx == (int)pts.size());
69 }
70 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
int kNumTigerPaths
TigerPath kTigerPaths[]
Definition: SkPath.h:59
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
std::vector< SkPoint > fPoints

◆ onDraw()

void TriangulatorBenchmark::onDraw ( int  loops,
SkCanvas  
)
inlinefinalprotectedvirtual

Implements Benchmark.

Definition at line 72 of file TriangulatorBench.cpp.

72 {
73 for (int i = 0; i < loops; ++i) {
74 this->doLoop();
75 }
76 }
virtual void doLoop()=0

◆ onGetName()

const char * TriangulatorBenchmark::onGetName ( )
inlineoverridevirtual

Implements Benchmark.

Definition at line 36 of file TriangulatorBench.cpp.

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

◆ unlock()

void TriangulatorBenchmark::unlock ( int  )
inlineoverrideprotectedvirtual

Implements GrEagerVertexAllocator.

Definition at line 87 of file TriangulatorBench.cpp.

87{}

Member Data Documentation

◆ fArena

SkArenaAllocWithReset TriangulatorBenchmark::fArena {GrTriangulator::kArenaDefaultChunkSize}
protected

Definition at line 95 of file TriangulatorBench.cpp.

◆ fName

SkString TriangulatorBenchmark::fName
protected

Definition at line 91 of file TriangulatorBench.cpp.

◆ fPaths

TArray<SkPath> TriangulatorBenchmark::fPaths
protected

Definition at line 92 of file TriangulatorBench.cpp.

◆ fVertexAllocSize

size_t TriangulatorBenchmark::fVertexAllocSize = 0
protected

Definition at line 94 of file TriangulatorBench.cpp.

◆ fVertexData

AutoTMalloc<char> TriangulatorBenchmark::fVertexData
protected

Definition at line 93 of file TriangulatorBench.cpp.


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