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

Public Member Functions

 DashBench (const SkScalar intervals[], int count, int width, bool doClip=false)
 
virtual void makePath (SkPath *path)
 
- 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
 
virtual void handlePath (SkCanvas *canvas, const SkPath &path, const SkPaint &paint, int N)
 
- 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 ()
 

Protected Attributes

SkString fName
 
SkTDArray< SkScalarfIntervals
 
int fWidth
 
SkPoint fPts [2]
 
bool fDoClip
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 

Detailed Description

Definition at line 32 of file DashBench.cpp.

Constructor & Destructor Documentation

◆ DashBench()

DashBench::DashBench ( const SkScalar  intervals[],
int  count,
int  width,
bool  doClip = false 
)
inline

Definition at line 41 of file DashBench.cpp.

42 {
43 fIntervals.append(count, intervals);
44 for (int i = 0; i < count; ++i) {
45 fIntervals[i] *= width;
46 }
47 fWidth = width;
48 fName.printf("dash_%d_%s", width, doClip ? "clipped" : "noclip");
49 fDoClip = doClip;
50
52 fPts[1].set(SkIntToScalar(600), SkIntToScalar(10));
53 }
int count
Definition: FontMgrTest.cpp:50
#define SkIntToScalar(x)
Definition: SkScalar.h:57
SkPoint fPts[2]
Definition: DashBench.cpp:37
bool fDoClip
Definition: DashBench.cpp:38
int fWidth
Definition: DashBench.cpp:36
SkString fName
Definition: DashBench.cpp:34
SkTDArray< SkScalar > fIntervals
Definition: DashBench.cpp:35
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
T * append()
Definition: SkTDArray.h:191
int32_t width
void set(float x, float y)
Definition: SkPoint_impl.h:200

Member Function Documentation

◆ handlePath()

virtual void DashBench::handlePath ( SkCanvas canvas,
const SkPath path,
const SkPaint paint,
int  N 
)
inlineprotectedvirtual

Reimplemented in RectDashBench.

Definition at line 87 of file DashBench.cpp.

88 {
89 for (int i = 0; i < N; ++i) {
90// canvas->drawPoints(SkCanvas::kLines_PointMode, 2, fPts, paint);
91 canvas->drawPath(path, paint);
92 }
93 }
#define N
Definition: beziers.cpp:19
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ makePath()

virtual void DashBench::makePath ( SkPath path)
inlinevirtual

Definition at line 55 of file DashBench.cpp.

55 {
57 }
static void path_hline(SkPath *path)
Definition: DashBench.cpp:27

◆ onDraw()

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

Implements Benchmark.

Definition at line 64 of file DashBench.cpp.

64 {
66 this->setupPaint(&paint);
68 paint.setStrokeWidth(SkIntToScalar(fWidth));
69 paint.setAntiAlias(false);
70
72 this->makePath(&path);
73
75
76 if (fDoClip) {
77 SkRect r = path.getBounds();
78 r.inset(-SkIntToScalar(20), -SkIntToScalar(20));
79 // now move it so we don't intersect
80 r.offset(0, r.height() * 3 / 2);
81 canvas->clipRect(r);
82 }
83
84 this->handlePath(canvas, path, paint, loops);
85 }
virtual void setupPaint(SkPaint *paint)
Definition: Benchmark.cpp:55
virtual void makePath(SkPath *path)
Definition: DashBench.cpp:55
virtual void handlePath(SkCanvas *canvas, const SkPath &path, const SkPaint &paint, int N)
Definition: DashBench.cpp:87
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
int size() const
Definition: SkTDArray.h:138
T * begin()
Definition: SkTDArray.h:150
void inset(float dx, float dy)
Definition: SkRect.h:1060
void offset(float dx, float dy)
Definition: SkRect.h:1016
constexpr float height() const
Definition: SkRect.h:769

◆ onGetName()

const char * DashBench::onGetName ( )
inlineoverrideprotectedvirtual

Implements Benchmark.

Definition at line 60 of file DashBench.cpp.

60 {
61 return fName.c_str();
62 }
const char * c_str() const
Definition: SkString.h:133

Member Data Documentation

◆ fDoClip

bool DashBench::fDoClip
protected

Definition at line 38 of file DashBench.cpp.

◆ fIntervals

SkTDArray<SkScalar> DashBench::fIntervals
protected

Definition at line 35 of file DashBench.cpp.

◆ fName

SkString DashBench::fName
protected

Definition at line 34 of file DashBench.cpp.

◆ fPts

SkPoint DashBench::fPts[2]
protected

Definition at line 37 of file DashBench.cpp.

◆ fWidth

int DashBench::fWidth
protected

Definition at line 36 of file DashBench.cpp.


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