Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | List of all members
Dashing3GM Class Reference
Inheritance diagram for Dashing3GM:
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 192 of file dashing.cpp.

Member Function Documentation

◆ getISize()

SkISize Dashing3GM::getISize ( )
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 195 of file dashing.cpp.

195{ return {640, 480}; }

◆ getName()

SkString Dashing3GM::getName ( ) const
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 193 of file dashing.cpp.

193{ return SkString("dashing3"); }

◆ onDraw()

void Dashing3GM::onDraw ( SkCanvas canvas)
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 237 of file dashing.cpp.

237 {
238 // 1on/1off 1x1 squares with phase of 0 - points fastpath
239 canvas->save();
240 canvas->translate(2, 0);
241 this->drawDashedLines(canvas, 100, 0, SK_Scalar1, 1, false);
242 canvas->restore();
243
244 // 1on/1off 1x1 squares with phase of .5 - rects fastpath (due to partial squares)
245 canvas->save();
246 canvas->translate(112, 0);
247 this->drawDashedLines(canvas, 100, SK_ScalarHalf, SK_Scalar1, 1, false);
248 canvas->restore();
249
250 // 1on/1off 1x1 squares with phase of 1 - points fastpath
251 canvas->save();
252 canvas->translate(222, 0);
253 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
254 canvas->restore();
255
256 // 1on/1off 1x1 squares with phase of 1 and non-integer length - rects fastpath
257 canvas->save();
258 canvas->translate(332, 0);
259 this->drawDashedLines(canvas, 99.5f, SK_ScalarHalf, SK_Scalar1, 1, false);
260 canvas->restore();
261
262 // 255on/255off 1x1 squares with phase of 0 - rects fast path
263 canvas->save();
264 canvas->translate(446, 0);
265 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(255), 1, false);
266 canvas->restore();
267
268 // 1on/1off 3x3 squares with phase of 0 - points fast path
269 canvas->save();
270 canvas->translate(2, 110);
271 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, false);
272 canvas->restore();
273
274 // 1on/1off 3x3 squares with phase of 1.5 - rects fast path
275 canvas->save();
276 canvas->translate(112, 110);
277 this->drawDashedLines(canvas, 100, 1.5f, SkIntToScalar(3), 3, false);
278 canvas->restore();
279
280 // 1on/1off 1x1 circles with phase of 1 - no fast path yet
281 canvas->save();
282 canvas->translate(2, 220);
283 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, true);
284 canvas->restore();
285
286 // 1on/1off 3x3 circles with phase of 1 - no fast path yet
287 canvas->save();
288 canvas->translate(112, 220);
289 this->drawDashedLines(canvas, 100, 0, SkIntToScalar(3), 3, true);
290 canvas->restore();
291
292 // 1on/1off 1x1 squares with rotation - should break fast path
293 canvas->save();
294 canvas->translate(332+SK_ScalarRoot2Over2*100, 110+SK_ScalarRoot2Over2*100);
295 canvas->rotate(45);
296 canvas->translate(-50, -50);
297
298 this->drawDashedLines(canvas, 100, SK_Scalar1, SK_Scalar1, 1, false);
299 canvas->restore();
300
301 // 3on/3off 3x1 rects - should use rect fast path regardless of phase
302 for (int phase = 0; phase <= 3; ++phase) {
303 canvas->save();
304 canvas->translate(SkIntToScalar(phase*110+2),
305 SkIntToScalar(330));
306 this->drawDashedLines(canvas, 100, SkIntToScalar(phase), SkIntToScalar(3), 1, false);
307 canvas->restore();
308 }
309 }
#define SK_Scalar1
Definition SkScalar.h:18
#define SK_ScalarHalf
Definition SkScalar.h:19
#define SkIntToScalar(x)
Definition SkScalar.h:57
#define SK_ScalarRoot2Over2
Definition SkScalar.h:23
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
void rotate(SkScalar degrees)
int save()
Definition SkCanvas.cpp:451

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