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

Public Member Functions

 Strokes3GM ()
 
- 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
 

Protected Member Functions

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
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 

Detailed Description

Definition at line 338 of file strokes.cpp.

Constructor & Destructor Documentation

◆ Strokes3GM()

Strokes3GM::Strokes3GM ( )
inline

Definition at line 380 of file strokes.cpp.

380{}

Member Function Documentation

◆ getISize()

SkISize Strokes3GM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 385 of file strokes.cpp.

385{ return SkISize::Make(1500, 1500); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString Strokes3GM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 383 of file strokes.cpp.

383{ return SkString("strokes3"); }

◆ onDraw()

void Strokes3GM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 387 of file strokes.cpp.

387 {
388 SkPaint origPaint;
389 origPaint.setAntiAlias(true);
391 SkPaint fillPaint(origPaint);
392 fillPaint.setColor(SK_ColorRED);
393 SkPaint strokePaint(origPaint);
394 strokePaint.setColor(ToolUtils::color_to_565(0xFF4444FF));
395
396 void (*procs[])(SkPath*, const SkRect&, SkString*) = {
397 make0, make1, make2, make3, make4, make5
398 };
399
400 canvas->translate(SkIntToScalar(20), SkIntToScalar(80));
401
403 SkScalar dx = bounds.width() * 4/3;
404 SkScalar dy = bounds.height() * 5;
405
406 for (size_t i = 0; i < std::size(procs); ++i) {
407 SkPath orig;
408 SkString str;
409 procs[i](&orig, bounds, &str);
410
411 canvas->save();
412 for (int j = 0; j < 13; ++j) {
413 strokePaint.setStrokeWidth(SK_Scalar1 * j * j);
414 canvas->drawPath(orig, strokePaint);
415 canvas->drawPath(orig, origPaint);
416 SkPath fill;
417 skpathutils::FillPathWithPaint(orig, strokePaint, &fill);
418 canvas->drawPath(fill, fillPaint);
419 canvas->translate(dx + strokePaint.getStrokeWidth(), 0);
420 }
421 canvas->restore();
422 canvas->translate(0, dy);
423 }
424 }
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
#define SK_Scalar1
Definition: SkScalar.h:18
#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
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
Optional< SkRect > bounds
Definition: SkRecords.h:189
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition: SkRecords.h:208
SkColor color_to_565(SkColor color)
Definition: ToolUtils.cpp:139
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
Definition: SkPathUtils.cpp:23
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609

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