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

Public Member Functions

 LineBench (SkScalar width, bool doAA)
 
- 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 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

Definition at line 19 of file LineBench.cpp.

Constructor & Destructor Documentation

◆ LineBench()

LineBench::LineBench ( SkScalar  width,
bool  doAA 
)
inline

Definition at line 29 of file LineBench.cpp.

29 {
30 fStrokeWidth = width;
31 fDoAA = doAA;
32 fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW");
33
34 SkRandom rand;
35 for (int i = 0; i < PTS; ++i) {
36 fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
37 }
38 }
SkScalar nextUScalar1()
Definition: SkRandom.h:101
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
int32_t width
void set(float x, float y)
Definition: SkPoint_impl.h:200

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 45 of file LineBench.cpp.

45 {
47 this->setupPaint(&paint);
48
50 paint.setAntiAlias(fDoAA);
51 paint.setStrokeWidth(fStrokeWidth);
52
53 for (int i = 0; i < loops; i++) {
54 canvas->drawPoints(SkCanvas::kLines_PointMode, PTS, fPts, paint);
55 }
56 }
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
Definition: SkCanvas.cpp:1710
@ kLines_PointMode
draw each pair of points as a line segment
Definition: SkCanvas.h:1242
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
const Paint & paint
Definition: color_source.cc:38

◆ onGetName()

const char * LineBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 41 of file LineBench.cpp.

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

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