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

Public Member Functions

 RectDashBench (const SkScalar intervals[], int count, int width)
 
- Public Member Functions inherited from DashBench
 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

void handlePath (SkCanvas *canvas, const SkPath &path, const SkPaint &paint, int N) override
 
- Protected Member Functions inherited from DashBench
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 ()
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum class  Backend {
  kNonRendering , kRaster , kGanesh , kGraphite ,
  kPDF , kHWUI
}
 
- Protected Attributes inherited from DashBench
SkString fName
 
SkTDArray< SkScalarfIntervals
 
int fWidth
 
SkPoint fPts [2]
 
bool fDoClip
 

Detailed Description

Definition at line 99 of file DashBench.cpp.

Constructor & Destructor Documentation

◆ RectDashBench()

RectDashBench::RectDashBench ( const SkScalar  intervals[],
int  count,
int  width 
)
inline

Definition at line 101 of file DashBench.cpp.

102 : INHERITED(intervals, count, width) {
103 fName.append("_rect");
104 }
int count
Definition: FontMgrTest.cpp:50
SkString fName
Definition: DashBench.cpp:34
void append(const char text[])
Definition: SkString.h:203
int32_t width

Member Function Documentation

◆ handlePath()

void RectDashBench::handlePath ( SkCanvas canvas,
const SkPath path,
const SkPaint paint,
int  N 
)
inlineoverrideprotectedvirtual

Reimplemented from DashBench.

Definition at line 107 of file DashBench.cpp.

107 {
108 SkPoint pts[2];
109 if (!path.isLine(pts) || pts[0].fY != pts[1].fY) {
110 this->INHERITED::handlePath(canvas, path, paint, N);
111 } else {
112 SkRect rect;
113 rect.fLeft = pts[0].fX;
114 rect.fTop = pts[0].fY - paint.getStrokeWidth() / 2;
115 rect.fRight = rect.fLeft + SkIntToScalar(fWidth);
116 rect.fBottom = rect.fTop + paint.getStrokeWidth();
117
118 SkPaint p(paint);
119 p.setStyle(SkPaint::kFill_Style);
120 p.setPathEffect(nullptr);
121
122 int count = SkScalarRoundToInt((pts[1].fX - pts[0].fX) / (2*fWidth));
124
125 for (int i = 0; i < N*10; ++i) {
126 SkRect r = rect;
127 for (int j = 0; j < count; ++j) {
128 canvas->drawRect(r, p);
129 r.offset(dx, 0);
130 }
131 }
132 }
133 }
#define SkScalarRoundToInt(x)
Definition: SkScalar.h:37
#define SkIntToScalar(x)
Definition: SkScalar.h:57
#define N
Definition: beziers.cpp:19
int fWidth
Definition: DashBench.cpp:36
virtual void handlePath(SkCanvas *canvas, const SkPath &path, const SkPaint &paint, int N)
Definition: DashBench.cpp:87
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
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
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
void offset(float dx, float dy)
Definition: SkRect.h:1016

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