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

Public Member Functions

 DrawPointsDashingBench (int dashLength, int strokeWidth, 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 247 of file DashBench.cpp.

Constructor & Destructor Documentation

◆ DrawPointsDashingBench()

DrawPointsDashingBench::DrawPointsDashingBench ( int  dashLength,
int  strokeWidth,
bool  doAA 
)
inline

Definition at line 255 of file DashBench.cpp.

256 {
257 fName.printf("drawpointsdash_%d_%d%s", dashLength, strokeWidth, doAA ? "_aa" : "_bw");
258 fStrokeWidth = strokeWidth;
259 fDoAA = doAA;
260
261 SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) };
262 fPathEffect = SkDashPathEffect::Make(vals, 2, SK_Scalar1);
263 }
static const int strokeWidth
Definition: BlurTest.cpp:60
#define SK_Scalar1
Definition: SkScalar.h:18
#define SkIntToScalar(x)
Definition: SkScalar.h:57
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
float SkScalar
Definition: extension.cpp:12

Member Function Documentation

◆ onDraw()

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

Implements Benchmark.

Definition at line 270 of file DashBench.cpp.

270 {
271 SkPaint p;
272 this->setupPaint(&p);
273 p.setColor(SK_ColorBLACK);
274 p.setStyle(SkPaint::kStroke_Style);
275 p.setStrokeWidth(SkIntToScalar(fStrokeWidth));
276 p.setPathEffect(fPathEffect);
277 p.setAntiAlias(fDoAA);
278
279 SkPoint pts[2] = {
280 { SkIntToScalar(10), 0 },
281 { SkIntToScalar(640), 0 }
282 };
283
284 for (int i = 0; i < loops; ++i) {
285 pts[0].fY = pts[1].fY = SkIntToScalar(i % 480);
286 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p);
287 }
288 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
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
float fY
y-axis value
Definition: SkPoint_impl.h:165

◆ onGetName()

const char * DrawPointsDashingBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 266 of file DashBench.cpp.

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

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