Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MapRectBench Class Referenceabstract
Inheritance diagram for MapRectBench:
Benchmark SkRefCnt SkRefCntBase M33_mapRectBench M4_mapRectBench

Public Member Functions

 MapRectBench (MapMatrixType type, const char name[])
 
bool isSuitableFor (Backend backend) override
 
virtual void performTest ()=0
 
- 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

virtual int mulLoopCount () const
 
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 ()
 

Protected Attributes

SkM44 fM
 
SkRect fS
 
SkRect fD
 

Additional Inherited Members

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

Detailed Description

Definition at line 155 of file Matrix44Bench.cpp.

Constructor & Destructor Documentation

◆ MapRectBench()

MapRectBench::MapRectBench ( MapMatrixType  type,
const char  name[] 
)
inline

Definition at line 159 of file Matrix44Bench.cpp.

159 {
160 SkRandom rand;
161 const char* typeName;
162 switch(type) {
164 typeName = "t";
165 fM = SkM44::Translate(rand.nextF(), rand.nextF());
166 break;
168 typeName = "s+t";
169 fM = SkM44::Scale(rand.nextF(), rand.nextF());
170 fM.postTranslate(rand.nextF(), rand.nextF());
171 break;
173 typeName = "r";
174 fM = SkM44::Rotate({0.f, 0.f, 1.f}, SkDegreesToRadians(45.f));
175 break;
177 typeName = "p";
178 // Hand chosen to have all corners with w > 0 and w != 1
179 fM = SkM44::Perspective(0.01f, 10.f, SK_ScalarPI / 3.f);
180 fM.preTranslate(0.f, 5.f, -0.1f);
181 fM.preConcat(SkM44::Rotate({0.f, 1.f, 0.f}, 0.008f /* radians */));
182 break;
184 typeName = "pc";
185 // Hand chosen to have some corners with w > 0 and some with w < 0
186 fM = SkM44();
187 fM.setRow(3, {-.2f, -.6f, 0.f, 8.f});
188 break;
189 }
190 fS = SkRect::MakeXYWH(10.f * rand.nextF(), 10.f * rand.nextF(),
191 150.f * rand.nextF(), 150.f * rand.nextF());
192
193 fName.printf("mapRect_%s_%s", name, typeName);
194 }
#define SkDegreesToRadians(degrees)
Definition: SkScalar.h:77
#define SK_ScalarPI
Definition: SkScalar.h:21
GLenum type
Definition: SkM44.h:150
SkM44 & postTranslate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.cpp:100
void setRow(int i, const SkV4 &v)
Definition: SkM44.h:281
static SkM44 Rotate(SkV3 axis, SkScalar radians)
Definition: SkM44.h:239
SkM44 & preConcat(const SkM44 &m)
Definition: SkM44.h:351
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:225
static SkM44 Perspective(float near, float far, float angle)
Definition: SkM44.cpp:343
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:232
SkM44 & preTranslate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.cpp:89
float nextF()
Definition: SkRandom.h:55
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
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

Member Function Documentation

◆ isSuitableFor()

bool MapRectBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 196 of file Matrix44Bench.cpp.

196{ return backend == Backend::kNonRendering; }
const char * backend

◆ mulLoopCount()

virtual int MapRectBench::mulLoopCount ( ) const
inlineprotectedvirtual

Definition at line 204 of file Matrix44Bench.cpp.

204{ return 1; }

◆ onDraw()

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

Implements Benchmark.

Definition at line 208 of file Matrix44Bench.cpp.

208 {
209 for (int i = 0; i < loops; i++) {
210 this->performTest();
211 }
212 }
virtual void performTest()=0

◆ onGetName()

const char * MapRectBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 206 of file Matrix44Bench.cpp.

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

◆ performTest()

virtual void MapRectBench::performTest ( )
pure virtual

Implemented in M4_mapRectBench, and M33_mapRectBench.

Member Data Documentation

◆ fD

SkRect MapRectBench::fD
protected

Definition at line 202 of file Matrix44Bench.cpp.

◆ fM

SkM44 MapRectBench::fM
protected

Definition at line 201 of file Matrix44Bench.cpp.

◆ fS

SkRect MapRectBench::fS
protected

Definition at line 202 of file Matrix44Bench.cpp.


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