Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | List of all members
Dashing2GM Class Reference
Inheritance diagram for Dashing2GM:
skiagm::GM

Private Member Functions

SkString getName () const override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) override
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onOnceBeforeDraw ()
 
virtual DrawResult onDraw (SkCanvas *, SkString *errorMsg)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Detailed Description

Definition at line 142 of file dashing.cpp.

Member Function Documentation

◆ getISize()

SkISize Dashing2GM::getISize ( )
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 145 of file dashing.cpp.

145{ return {640, 480}; }

◆ getName()

SkString Dashing2GM::getName ( ) const
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 143 of file dashing.cpp.

143{ return SkString("dashing2"); }

◆ onDraw()

void Dashing2GM::onDraw ( SkCanvas canvas)
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 147 of file dashing.cpp.

147 {
148 constexpr int gIntervals[] = {
149 3, // 3 dashes: each count [0] followed by intervals [1..count]
150 2, 10, 10,
151 4, 20, 5, 5, 5,
152 2, 2, 2
153 };
154
155 SkPath (*gProc[])(const SkRect&) = {
157 };
158
160 paint.setAntiAlias(true);
161 paint.setStroke(true);
162 paint.setStrokeWidth(SkIntToScalar(6));
163
165 bounds.offset(SkIntToScalar(20), SkIntToScalar(20));
166 SkScalar dx = bounds.width() * 4 / 3;
167 SkScalar dy = bounds.height() * 4 / 3;
168
169 const int* intervals = &gIntervals[1];
170 for (int y = 0; y < gIntervals[0]; ++y) {
171 SkScalar vals[std::size(gIntervals)]; // more than enough
172 int count = *intervals++;
173 for (int i = 0; i < count; ++i) {
174 vals[i] = SkIntToScalar(*intervals++);
175 }
176 SkScalar phase = vals[0] / 2;
177 paint.setPathEffect(SkDashPathEffect::Make(vals, count, phase));
178
179 for (size_t x = 0; x < std::size(gProc); ++x) {
180 SkPath path;
181 SkRect r = bounds;
182 r.offset(x * dx, y * dy);
183 canvas->drawPath(gProc[x](r), paint);
184 }
185 }
186 }
int count
#define SkIntToScalar(x)
Definition SkScalar.h:57
static const SlideProc gProc[]
void drawPath(const SkPath &path, const SkPaint &paint)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
const Paint & paint
static SkPath make_path_rect(const SkRect &bounds)
Definition dashing.cpp:128
static SkPath make_path_line(const SkRect &bounds)
Definition dashing.cpp:122
static SkPath make_path_star(const SkRect &bounds)
Definition dashing.cpp:136
static SkPath make_path_oval(const SkRect &bounds)
Definition dashing.cpp:132
float SkScalar
Definition extension.cpp:12
double y
double x
Optional< SkRect > bounds
Definition SkRecords.h:189
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
void offset(float dx, float dy)
Definition SkRect.h:1016
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

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