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

Public Member Functions

 IsFiniteBench (int index)
 
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

void onDraw (int loops, SkCanvas *) override
 
const char * onGetName () 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 240 of file MathBench.cpp.

Constructor & Destructor Documentation

◆ IsFiniteBench()

IsFiniteBench::IsFiniteBench ( int  index)
inline

Definition at line 247 of file MathBench.cpp.

247 {
248 SkRandom rand;
249
250 for (int i = 0; i < N; ++i) {
251 fData[i] = rand.nextSScalar1();
252 }
253
254 if (index < 0) {
255 fProc = nullptr;
256 fName = "isfinite_rect";
257 } else {
258 fProc = gRec[index].fProc;
259 fName = gRec[index].fName;
260 }
261 }
static const struct @229 gRec[]
SkScalar nextSScalar1()
Definition: SkRandom.h:113

Member Function Documentation

◆ isSuitableFor()

bool IsFiniteBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 263 of file MathBench.cpp.

263 {
265 }
const char * backend

◆ onDraw()

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

Implements Benchmark.

Definition at line 268 of file MathBench.cpp.

268 {
269 IsFiniteProc proc = fProc;
270 const float* data = fData;
271 // do this so the compiler won't throw away the function call
272 int counter = 0;
273
274 if (proc) {
275 for (int j = 0; j < loops; ++j) {
276 for (int i = 0; i < N - 4; ++i) {
277 counter += proc(&data[i]);
278 }
279 }
280 } else {
281 for (int j = 0; j < loops; ++j) {
282 for (int i = 0; i < N - 4; ++i) {
283 const SkRect* r = reinterpret_cast<const SkRect*>(&data[i]);
284 if ((false)) { // avoid bit rot, suppress warning
285 isFinite(*r);
286 }
287 counter += r->isFinite();
288 }
289 }
290 }
291
293 if (paint.getAlpha() == 0) {
294 SkDebugf("%d\n", counter);
295 }
296 }
static bool isFinite(const SkRect &r)
Definition: MathBench.cpp:230
bool(* IsFiniteProc)(const float[])
Definition: MathBench.cpp:214
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const Paint & paint
Definition: color_source.cc:38
bool isFinite() const
Definition: SkRect.h:711
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ onGetName()

const char * IsFiniteBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 298 of file MathBench.cpp.

298 {
299 return fName;
300 }

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