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

Public Member Functions

 SliverPathsGM ()
 
- 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 138 of file mandoline.cpp.

Constructor & Destructor Documentation

◆ SliverPathsGM()

skiagm::SliverPathsGM::SliverPathsGM ( )
inline

Definition at line 140 of file mandoline.cpp.

140 {
142 }
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
void setBGColor(SkColor)
Definition: gm.cpp:159

Member Function Documentation

◆ getISize()

SkISize skiagm::SliverPathsGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 147 of file mandoline.cpp.

147{ return SkISize::Make(560, 475); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

SkString skiagm::SliverPathsGM::getName ( ) const
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 145 of file mandoline.cpp.

145{ return SkString("mandoline"); }

◆ onDraw()

void skiagm::SliverPathsGM::onDraw ( SkCanvas canvas)
inlineoverrideprotectedvirtual

Reimplemented from skiagm::GM.

Definition at line 149 of file mandoline.cpp.

149 {
151 paint.setColor(SK_ColorWHITE);
152 paint.setAntiAlias(true);
153
154 MandolineSlicer mandoline({41, 43});
155 mandoline.sliceCubic({5, 277}, {381, -74}, {243, 162});
156 mandoline.sliceLine({41, 43});
157 canvas->drawPath(mandoline.path(), paint);
158
159 mandoline.reset({357.049988f, 446.049988f});
160 mandoline.sliceCubic({472.750000f, -71.950012f}, {639.750000f, 531.950012f},
161 {309.049988f, 347.950012f});
162 mandoline.sliceLine({309.049988f, 419});
163 mandoline.sliceLine({357.049988f, 446.049988f});
164 canvas->drawPath(mandoline.path(), paint);
165
166 canvas->save();
167 canvas->translate(421, 105);
168 canvas->scale(100, 81);
169 mandoline.reset({-cosf(SkDegreesToRadians(-60)), sinf(SkDegreesToRadians(-60))});
170 mandoline.sliceConic({-2, 0},
171 {-cosf(SkDegreesToRadians(60)), sinf(SkDegreesToRadians(60))}, .5f);
172 mandoline.sliceConic({-cosf(SkDegreesToRadians(120))*2, sinf(SkDegreesToRadians(120))*2},
173 {1, 0}, .5f);
174 mandoline.sliceLine({0, 0});
175 mandoline.sliceLine({-cosf(SkDegreesToRadians(-60)), sinf(SkDegreesToRadians(-60))});
176 canvas->drawPath(mandoline.path(), paint);
177 canvas->restore();
178
179 canvas->save();
180 canvas->translate(150, 300);
181 canvas->scale(75, 75);
182 mandoline.reset({1, 0});
183 constexpr int nquads = 5;
184 for (int i = 0; i < nquads; ++i) {
185 float theta1 = 2*SK_ScalarPI/nquads * (i + .5f);
186 float theta2 = 2*SK_ScalarPI/nquads * (i + 1);
187 mandoline.sliceQuadratic({cosf(theta1)*2, sinf(theta1)*2},
188 {cosf(theta2), sinf(theta2)});
189 }
190 canvas->drawPath(mandoline.path(), paint);
191 canvas->restore();
192 }
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
#define SkDegreesToRadians(degrees)
Definition: SkScalar.h:77
#define SK_ScalarPI
Definition: SkScalar.h:21
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 scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
const Paint & paint
Definition: color_source.cc:38

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