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

Public Member Functions

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

Static Protected Member Functions

static void draw_path (SkScalar size, SkCanvas *canvas, SkPaint paint)
 

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 17 of file scaledstrokes.cpp.

Constructor & Destructor Documentation

◆ ScaledStrokesGM()

ScaledStrokesGM::ScaledStrokesGM ( )
inline

Definition at line 19 of file scaledstrokes.cpp.

19{}

Member Function Documentation

◆ draw_path()

static void ScaledStrokesGM::draw_path ( SkScalar  size,
SkCanvas canvas,
SkPaint  paint 
)
inlinestaticprotected

Definition at line 26 of file scaledstrokes.cpp.

26 {
27 SkScalar c = 0.551915024494f * size;
29 path.moveTo(0.0f, size);
30 path.cubicTo(c, size, size, c, size, 0.0f);
31 path.cubicTo(size, -c, c, -size, 0.0f, -size);
32 path.cubicTo(-c, -size, -size, -c, -size, 0.0f);
33 path.cubicTo(-size, c, -c, size, 0.0f, size);
34 canvas->drawPath(path.detach(), paint);
35 }
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
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
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

◆ getISize()

SkISize ScaledStrokesGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 24 of file scaledstrokes.cpp.

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

◆ getName()

SkString ScaledStrokesGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 22 of file scaledstrokes.cpp.

22{ return SkString("scaledstrokes"); }

◆ onDraw()

void ScaledStrokesGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 37 of file scaledstrokes.cpp.

37 {
40 paint.setStyle(SkPaint::Style::kStroke_Style);
41 canvas->translate(5.0f, 5.0f);
42 const SkScalar size = 60.0f;
43 for (int i = 0; i < 2; i++) {
44 paint.setAntiAlias(i == 1);
45 for (int j = 0; j < 4; j++) {
46 SkScalar scale = 4.0f - j;
47 paint.setStrokeWidth(4.0f / scale);
48 canvas->save();
49 canvas->translate(size / 2.0f, size / 2.0f);
50 canvas->scale(scale, scale);
51 draw_path(size / 2.0f / scale, canvas, paint);
52 canvas->restore();
53
54 canvas->save();
55 canvas->translate(size / 2.0f, 80.0f + size / 2.0f);
56 canvas->scale(scale, scale);
57 canvas->drawCircle(0.0f, 0.0f, size / 2.0f / scale, paint);
58 canvas->restore();
59
60 canvas->save();
61 canvas->translate(0.0f, 160.0f);
62 canvas->scale(scale, scale);
63 canvas->drawRect(SkRect::MakeXYWH(0.0f, 0.0f, size / scale, size / scale), paint);
64 canvas->restore();
65
66 canvas->save();
67 canvas->translate(0.0f, 240.0f);
68 canvas->scale(scale, scale);
69 canvas->drawLine(0.0f, 0.0f, size / scale, size / scale, paint);
70 canvas->restore();
71
72 canvas->translate(80.0f, 0.0f);
73 }
74 }
75
76 }
static void draw_path(SkScalar size, SkCanvas *canvas, SkPaint paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
int save()
Definition: SkCanvas.cpp:447
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
Definition: SkPath.h:59
const Scalar scale
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

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