Flutter Engine
The Flutter Engine
Protected Member Functions | List of all members
SmallPathsGM Class Reference
Inheritance diagram for SmallPathsGM:
skiagm::GM

Protected Member Functions

void onOnceBeforeDraw () override
 
SkString getName () const override
 
SkISize getISize () override
 
void onDraw (SkCanvas *canvas) override
 
- 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 void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

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 SkISize getISize ()=0
 
virtual SkString getName () const =0
 
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 []
 

Detailed Description

Definition at line 323 of file smallpaths.cpp.

Member Function Documentation

◆ getISize()

SkISize SmallPathsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 337 of file smallpaths.cpp.

337{ return SkISize::Make(640, 512); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString SmallPathsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 335 of file smallpaths.cpp.

335{ return SkString("smallpaths"); }

◆ onDraw()

void SmallPathsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 339 of file smallpaths.cpp.

339 {
341 paint.setAntiAlias(true);
342
343 // first column: filled paths
344 canvas->save();
345 for (size_t i = 0; i < N; i++) {
346 canvas->drawPath(fPath[i], paint);
347 canvas->translate(gXTranslate[i], fDY[i]);
348 }
349 canvas->restore();
350 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
351
352 // second column: stroked paths
353 canvas->save();
355 paint.setStrokeCap(SkPaint::kButt_Cap);
356 for (size_t i = 0; i < N; i++) {
357 paint.setStrokeWidth(gWidths[i]);
358 paint.setStrokeMiter(gMiters[i]);
359 canvas->drawPath(fPath[i], paint);
360 canvas->translate(gXTranslate[i], fDY[i]);
361 }
362 canvas->restore();
363 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
364
365 // third column: stroked paths with different widths
366 canvas->save();
368 paint.setStrokeCap(SkPaint::kButt_Cap);
369 for (size_t i = 0; i < N; i++) {
370 paint.setStrokeWidth(gWidths[i] + 2.0f);
371 paint.setStrokeMiter(gMiters[i]);
372 canvas->drawPath(fPath[i], paint);
373 canvas->translate(gXTranslate[i], fDY[i]);
374 }
375 canvas->restore();
376 canvas->translate(SkIntToScalar(120), SkIntToScalar(0));
377
378 // fourth column: stroked and filled paths
380 paint.setStrokeCap(SkPaint::kButt_Cap);
381 for (size_t i = 0; i < N; i++) {
382 paint.setStrokeWidth(gWidths[i]);
383 paint.setStrokeMiter(gMiters[i]);
384 canvas->drawPath(fPath[i], paint);
385 canvas->translate(gXTranslate[i], fDY[i]);
386 }
387
388 }
#define SkIntToScalar(x)
Definition: SkScalar.h:57
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kButt_Cap
no stroke extension
Definition: SkPaint.h:334
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kStrokeAndFill_Style
sets to stroke and fill geometry
Definition: SkPaint.h:195
const Paint & paint
Definition: color_source.cc:38
#define N
Definition: smallpaths.cpp:317
constexpr SkScalar gMiters[]
Definition: smallpaths.cpp:287
constexpr SkScalar gWidths[]
Definition: smallpaths.cpp:272
constexpr SkScalar gXTranslate[]
Definition: smallpaths.cpp:302

◆ onOnceBeforeDraw()

void SmallPathsGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 327 of file smallpaths.cpp.

327 {
328 for (size_t i = 0; i < N; i++) {
329 auto [path, dy] = gProcs[i]();
330 fPath[i] = path;
331 fDY[i] = dy;
332 }
333 }
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
constexpr MakePathProc gProcs[]
Definition: smallpaths.cpp:258

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