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

Public Member Functions

 FSRectBench ()
 
- 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

const char * onGetName () override
 
void onDelayedSetup () override
 
void onDraw (int loops, SkCanvas *canvas) 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

Draws full screen opaque rectangles. It is designed to test any optimizations in the GPU backend to turn such draws into clears.

Definition at line 17 of file FSRectBench.cpp.

Constructor & Destructor Documentation

◆ FSRectBench()

FSRectBench::FSRectBench ( )
inline

Definition at line 19 of file FSRectBench.cpp.

19: fInit(false) { }

Member Function Documentation

◆ onDelayedSetup()

void FSRectBench::onDelayedSetup ( )
inlineoverrideprotectedvirtual

Reimplemented from Benchmark.

Definition at line 24 of file FSRectBench.cpp.

24 {
25 if (!fInit) {
26 SkRandom rand;
27 static const SkScalar kMinOffset = 0;
28 static const SkScalar kMaxOffset = 100 * SK_Scalar1;
29 static const SkScalar kOffsetRange = kMaxOffset - kMinOffset;
30 for (int i = 0; i < N; ++i) {
31 fRects[i].fLeft = -kMinOffset - rand.nextUScalar1() * kOffsetRange;
32 fRects[i].fTop = -kMinOffset - rand.nextUScalar1() * kOffsetRange;
33 fRects[i].fRight = W + kMinOffset + rand.nextUScalar1() * kOffsetRange;
34 fRects[i].fBottom = H + kMinOffset + rand.nextUScalar1() * kOffsetRange;
35 fColors[i] = rand.nextU() | 0xFF000000;
36 }
37 fInit = true;
38 }
39 }
#define SK_Scalar1
Definition: SkScalar.h:18
uint32_t nextU()
Definition: SkRandom.h:42
SkScalar nextUScalar1()
Definition: SkRandom.h:101
float SkScalar
Definition: extension.cpp:12
Definition: SkMD5.cpp:130
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

◆ onDraw()

void FSRectBench::onDraw ( int  loops,
SkCanvas canvas 
)
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 41 of file FSRectBench.cpp.

41 {
43 for (int i = 0; i < loops; ++i) {
44 paint.setColor(fColors[i % N]);
45 canvas->drawRect(fRects[i % N], paint);
46 }
47 }
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
const Paint & paint
Definition: color_source.cc:38

◆ onGetName()

const char * FSRectBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 22 of file FSRectBench.cpp.

22{ return "fullscreen_rects"; }

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