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

Protected Member Functions

SkString getName () const override
 
SkISize getISize () override
 
template<typename Proc >
void append_path (Proc proc)
 
void onOnceBeforeDraw () override
 
void drawGiantCircle (SkCanvas *canvas)
 
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 24 of file conicpaths.cpp.

Member Function Documentation

◆ append_path()

template<typename Proc >
void ConicPathsGM::append_path ( Proc  proc)
inlineprotected

Definition at line 30 of file conicpaths.cpp.

30 {
32 proc(&b);
33 fPaths.push_back(b.detach());
34 }
static bool b

◆ drawGiantCircle()

void ConicPathsGM::drawGiantCircle ( SkCanvas canvas)
inlineprotected

Definition at line 99 of file conicpaths.cpp.

99 {
101 canvas->drawPath(fGiantCircle, paint);
102 }
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38

◆ getISize()

SkISize ConicPathsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 28 of file conicpaths.cpp.

28{ return SkISize::Make(920, 960); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString ConicPathsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 26 of file conicpaths.cpp.

26{ return SkString("conicpaths"); }

◆ onDraw()

void ConicPathsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 104 of file conicpaths.cpp.

104 {
105 const SkAlpha kAlphaValue[] = { 0xFF, 0x40 };
106
107 const SkScalar margin = 15;
108 canvas->translate(margin, margin);
109
111 for (int p = 0; p < fPaths.size(); ++p) {
112 canvas->save();
113 for (size_t a = 0; a < std::size(kAlphaValue); ++a) {
114 paint.setARGB(kAlphaValue[a], 0, 0, 0);
115 for (int aa = 0; aa < 2; ++aa) {
116 paint.setAntiAlias(SkToBool(aa));
117 for (int fh = 0; fh < 2; ++fh) {
118 paint.setStroke(fh != 0);
119
120 const SkRect& bounds = fPaths[p].getBounds();
121 canvas->save();
122 canvas->translate(-bounds.fLeft, -bounds.fTop);
123 canvas->drawPath(fPaths[p], paint);
124 canvas->restore();
125
126 canvas->translate(110, 0);
127 }
128 }
129 }
130 canvas->restore();
131 canvas->translate(0, 110);
132 }
133 canvas->restore();
134
135 this->drawGiantCircle(canvas);
136 }
uint8_t SkAlpha
Definition: SkColor.h:26
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
void drawGiantCircle(SkCanvas *canvas)
Definition: conicpaths.cpp:99
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
int size() const
Definition: SkTArray.h:421
float SkScalar
Definition: extension.cpp:12
struct MyStruct a[10]
Optional< SkRect > bounds
Definition: SkRecords.h:189
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

◆ onOnceBeforeDraw()

void ConicPathsGM::onOnceBeforeDraw ( )
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 36 of file conicpaths.cpp.

36 {
37 this->append_path([](SkPathBuilder* conicCircle) {
38 const SkScalar w = SkScalarSqrt(2)/2;
39 conicCircle->moveTo(0, 0);
40 conicCircle->conicTo(0, 50, 50, 50, w);
41 conicCircle->rConicTo(50, 0, 50, -50, w);
42 conicCircle->rConicTo(0, -50, -50, -50, w);
43 conicCircle->rConicTo(-50, 0, -50, 50, w);
44 });
45
46 this->append_path([](SkPathBuilder* hyperbola) {
47 hyperbola->moveTo(0, 0);
48 hyperbola->conicTo(0, 100, 100, 100, 2);
49 });
50
51 this->append_path([](SkPathBuilder* thinHyperbola) {
52 thinHyperbola->moveTo(0, 0);
53 thinHyperbola->conicTo(100, 100, 5, 0, 2);
54 });
55
56 this->append_path([](SkPathBuilder* veryThinHyperbola) {
57 veryThinHyperbola->moveTo(0, 0);
58 veryThinHyperbola->conicTo(100, 100, 1, 0, 2);
59 });
60
61 this->append_path([](SkPathBuilder* closedHyperbola) {
62 closedHyperbola->moveTo(0, 0);
63 closedHyperbola->conicTo(100, 100, 0, 0, 2);
64 });
65
66 this->append_path([](SkPathBuilder* nearParabola) {
67 // using 1 as weight defaults to using quadTo
68 nearParabola->moveTo(0, 0);
69 nearParabola->conicTo(0, 100, 100, 100, 0.999f);
70 });
71
72 this->append_path([](SkPathBuilder* thinEllipse) {
73 thinEllipse->moveTo(0, 0);
74 thinEllipse->conicTo(100, 100, 5, 0, SK_ScalarHalf);
75 });
76
77 this->append_path([](SkPathBuilder* veryThinEllipse) {
78 veryThinEllipse->moveTo(0, 0);
79 veryThinEllipse->conicTo(100, 100, 1, 0, SK_ScalarHalf);
80 });
81
82 this->append_path([](SkPathBuilder* closedEllipse) {
83 closedEllipse->moveTo(0, 0);
84 closedEllipse->conicTo(100, 100, 0, 0, SK_ScalarHalf);
85 });
86
87 {
89 const SkScalar w = SkScalarSqrt(2)/2;
90 b.moveTo(2.1e+11f, -1.05e+11f);
91 b.conicTo(2.1e+11f, 0, 1.05e+11f, 0, w);
92 b.conicTo(0, 0, 0, -1.05e+11f, w);
93 b.conicTo(0, -2.1e+11f, 1.05e+11f, -2.1e+11f, w);
94 b.conicTo(2.1e+11f, -2.1e+11f, 2.1e+11f, -1.05e+11f, w);
95 fGiantCircle = b.detach();
96 }
97 }
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkScalarSqrt(x)
Definition: SkScalar.h:42
void append_path(Proc proc)
Definition: conicpaths.cpp:30
SkPathBuilder & conicTo(SkPoint pt1, SkPoint pt2, SkScalar w)
SkPathBuilder & moveTo(SkPoint pt)
SkPathBuilder & rConicTo(SkPoint p1, SkPoint p2, SkScalar w)
SkScalar w

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