Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Floor2IntBench Class Reference
Inheritance diagram for Floor2IntBench:
Benchmark SkRefCnt SkRefCntBase

Public Member Functions

 Floor2IntBench (bool sat)
 
bool isSuitableFor (Backend backend) override
 
virtual void process (unsigned)
 
virtual int count ()
 
- 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
 

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 * onGetUniqueName ()
 
virtual void onDelayedSetup ()
 
virtual void onPerCanvasPreDraw (SkCanvas *)
 
virtual void onPerCanvasPostDraw (SkCanvas *)
 
virtual void onPreDraw (SkCanvas *)
 
virtual void onPostDraw (SkCanvas *)
 
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 611 of file MathBench.cpp.

Constructor & Destructor Documentation

◆ Floor2IntBench()

Floor2IntBench::Floor2IntBench ( bool  sat)
inline

Definition at line 619 of file MathBench.cpp.

619 : fSat(sat) {
620 SkRandom rand;
621
622 for (int i = 0; i < ARRAY; ++i) {
623 fData[i] = SkBits2Float(rand.nextU());
624 }
625
626 if (sat) {
627 fName = "floor2int_sat";
628 } else {
629 fName = "floor2int_undef";
630 }
631 }
static float SkBits2Float(uint32_t bits)
Definition SkFloatBits.h:48
uint32_t nextU()
Definition SkRandom.h:42
static float sat(float r, float g, float b)
Definition hsl.cpp:51

Member Function Documentation

◆ count()

virtual int Floor2IntBench::count ( )
inlinevirtual

Definition at line 640 of file MathBench.cpp.

640{ return ARRAY; }

◆ isSuitableFor()

bool Floor2IntBench::isSuitableFor ( Backend  backend)
inlineoverridevirtual

Reimplemented from Benchmark.

Definition at line 633 of file MathBench.cpp.

633 {
635 }
const char * backend

◆ onDraw()

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

Implements Benchmark.

Definition at line 643 of file MathBench.cpp.

643 {
644 // used unsigned to avoid undefined behavior if/when the += might overflow
645 unsigned accum = 0;
646
647 for (int j = 0; j < loops; ++j) {
648 int n = this->count();
649 if (fSat) {
650 for (int i = 0; i < n; ++i) {
651 accum += sk_float_floor2int(fData[i]);
652 }
653 } else {
654 for (int i = 0; i < n; ++i) {
655 accum += sk_float_floor2int_no_saturate(fData[i]);
656 }
657 }
658 this->process(accum);
659 }
660 }
#define sk_float_floor2int_no_saturate(x)
#define sk_float_floor2int(x)
virtual int count()
virtual void process(unsigned)

◆ onGetName()

const char * Floor2IntBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 662 of file MathBench.cpp.

662{ return fName; }

◆ process()

virtual void Floor2IntBench::process ( unsigned  )
inlinevirtual

Definition at line 639 of file MathBench.cpp.

639{}

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