Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GiantDashBench Class Reference
Inheritance diagram for GiantDashBench:
Benchmark SkRefCnt SkRefCntBase

Public Types

enum  LineType { kHori_LineType , kVert_LineType , kDiag_LineType , kLineTypeCount }
 
- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Public Member Functions

 GiantDashBench (LineType lt, SkScalar width)
 
- 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
 

Static Public Member Functions

static const char * LineTypeName (LineType lt)
 

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

Detailed Description

Definition at line 295 of file DashBench.cpp.

Member Enumeration Documentation

◆ LineType

Enumerator
kHori_LineType 
kVert_LineType 
kDiag_LineType 
kLineTypeCount 

Definition at line 302 of file DashBench.cpp.

Constructor & Destructor Documentation

◆ GiantDashBench()

GiantDashBench::GiantDashBench ( LineType  lt,
SkScalar  width 
)
inline

Definition at line 315 of file DashBench.cpp.

315 {
316 fName.printf("giantdashline_%s_%g", LineTypeName(lt), width);
317 fStrokeWidth = width;
318
319 // deliberately pick intervals that won't be caught by asPoints(), so
320 // we can test the filterPath code-path.
321 const SkScalar intervals[] = { 20, 10, 10, 10 };
322 fPathEffect = SkDashPathEffect::Make(intervals, std::size(intervals), 0);
323
324 SkScalar cx = 640 / 2; // center X
325 SkScalar cy = 480 / 2; // center Y
327
328 switch (lt) {
329 case kHori_LineType:
330 matrix.setIdentity();
331 break;
332 case kVert_LineType:
333 matrix.setRotate(90, cx, cy);
334 break;
335 case kDiag_LineType:
336 matrix.setRotate(45, cx, cy);
337 break;
338 case kLineTypeCount:
339 // Not a real enum value.
340 break;
341 }
342
343 const SkScalar overshoot = 100*1000;
344 const SkPoint pts[2] = {
345 { -overshoot, cy }, { 640 + overshoot, cy }
346 };
347 matrix.mapPoints(fPts, pts, 2);
348 }
static const char * LineTypeName(LineType lt)
Definition: DashBench.cpp:309
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
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
int32_t width

Member Function Documentation

◆ LineTypeName()

static const char * GiantDashBench::LineTypeName ( LineType  lt)
inlinestatic

Definition at line 309 of file DashBench.cpp.

309 {
310 static const char* gNames[] = { "hori", "vert", "diag" };
311 static_assert(kLineTypeCount == std::size(gNames), "names_wrong_size");
312 return gNames[lt];
313 }

◆ onDraw()

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

Implements Benchmark.

Definition at line 355 of file DashBench.cpp.

355 {
356 SkPaint p;
357 this->setupPaint(&p);
358 p.setStyle(SkPaint::kStroke_Style);
359 p.setStrokeWidth(fStrokeWidth);
360 p.setPathEffect(fPathEffect);
361
362 for (int i = 0; i < loops; i++) {
363 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, p);
364 }
365 }
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

◆ onGetName()

const char * GiantDashBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 351 of file DashBench.cpp.

351 {
352 return fName.c_str();
353 }
const char * c_str() const
Definition: SkString.h:133

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