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

Public Member Functions

 QuadClosePathGM ()
 
- 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 drawPath (SkPath &path, SkCanvas *canvas, SkColor color, const SkRect &clip, SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPathFillType fill, SkScalar strokeWidth)
 
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 153 of file quadpaths.cpp.

Constructor & Destructor Documentation

◆ QuadClosePathGM()

skiagm::QuadClosePathGM::QuadClosePathGM ( )
inline

Definition at line 155 of file quadpaths.cpp.

155{}

Member Function Documentation

◆ drawPath()

void skiagm::QuadClosePathGM::drawPath ( SkPath path,
SkCanvas canvas,
SkColor  color,
const SkRect clip,
SkPaint::Cap  cap,
SkPaint::Join  join,
SkPaint::Style  style,
SkPathFillType  fill,
SkScalar  strokeWidth 
)
inlineprotected

Definition at line 162 of file quadpaths.cpp.

165 {
166 path.setFillType(fill);
168 paint.setStrokeCap(cap);
169 paint.setStrokeWidth(strokeWidth);
170 paint.setStrokeJoin(join);
171 paint.setColor(color);
172 paint.setStyle(style);
173 canvas->save();
174 canvas->clipRect(clip);
175 canvas->drawPath(path, paint);
176 canvas->restore();
177 }
static const int strokeWidth
Definition: BlurTest.cpp:60
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
int save()
Definition: SkCanvas.cpp:447
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38
DlColor color
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
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ getISize()

SkISize skiagm::QuadClosePathGM::getISize ( )
inlineoverrideprotectedvirtual

Implements skiagm::GM.

Definition at line 160 of file quadpaths.cpp.

160{ return SkISize::Make(1240, 390); }
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ getName()

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

Implements skiagm::GM.

Definition at line 158 of file quadpaths.cpp.

158{ return SkString("quadclosepath"); }

◆ onDraw()

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

Reimplemented from skiagm::GM.

Definition at line 179 of file quadpaths.cpp.

179 {
180 struct FillAndName {
181 SkPathFillType fFill;
182 const char* fName;
183 };
184 constexpr FillAndName gFills[] = {
185 {SkPathFillType::kWinding, "Winding"},
186 {SkPathFillType::kEvenOdd, "Even / Odd"},
187 {SkPathFillType::kInverseWinding, "Inverse Winding"},
188 {SkPathFillType::kInverseEvenOdd, "Inverse Even / Odd"},
189 };
190 struct StyleAndName {
192 const char* fName;
193 };
194 constexpr StyleAndName gStyles[] = {
195 {SkPaint::kFill_Style, "Fill"},
196 {SkPaint::kStroke_Style, "Stroke"},
197 {SkPaint::kStrokeAndFill_Style, "Stroke And Fill"},
198 };
199 struct CapAndName {
200 SkPaint::Cap fCap;
202 const char* fName;
203 };
204 constexpr CapAndName gCaps[] = {
208 };
209 struct PathAndName {
211 const char* fName;
212 };
213 PathAndName path;
214 path.fPath.moveTo(25*SK_Scalar1, 10*SK_Scalar1);
215 path.fPath.quadTo(50*SK_Scalar1, 20*SK_Scalar1,
216 75*SK_Scalar1, 10*SK_Scalar1);
217 path.fPath.close();
218 path.fName = "moveTo-quad-close";
219
220 SkPaint titlePaint;
223 const char title[] = "Quad Closed Drawn Into Rectangle Clips With "
224 "Indicated Style, Fill and Linecaps, with stroke width 10";
225 canvas->drawString(title, 20.0f, 20.0f, font, titlePaint);
226
227 SkRandom rand;
229 canvas->save();
230 canvas->translate(10 * SK_Scalar1, 30 * SK_Scalar1);
231 canvas->save();
232 for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
233 if (0 < cap) {
234 canvas->translate((rect.width() + 40 * SK_Scalar1) * std::size(gStyles), 0);
235 }
236 canvas->save();
237 for (size_t fill = 0; fill < std::size(gFills); ++fill) {
238 if (0 < fill) {
239 canvas->translate(0, rect.height() + 40 * SK_Scalar1);
240 }
241 canvas->save();
242 for (size_t style = 0; style < std::size(gStyles); ++style) {
243 if (0 < style) {
244 canvas->translate(rect.width() + 40 * SK_Scalar1, 0);
245 }
246
248 this->drawPath(path.fPath, canvas, color, rect,
249 gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle,
250 gFills[fill].fFill, SK_Scalar1*10);
251
252 SkPaint rectPaint;
253 rectPaint.setColor(SK_ColorBLACK);
255 rectPaint.setStrokeWidth(-1);
256 rectPaint.setAntiAlias(true);
257 canvas->drawRect(rect, rectPaint);
258
259 SkPaint labelPaint;
260 labelPaint.setColor(color);
261 canvas->drawString(gStyles[style].fName, 0, rect.height() + 12.0f,
262 labelFont, labelPaint);
263 canvas->drawString(gFills[fill].fName, 0, rect.height() + 24.0f,
264 labelFont, labelPaint);
265 canvas->drawString(gCaps[cap].fName, 0, rect.height() + 36.0f,
266 labelFont, labelPaint);
267 }
268 canvas->restore();
269 }
270 canvas->restore();
271 }
272 canvas->restore();
273 canvas->restore();
274 }
SkPath fPath
SkPaint::Join fJoin
SkStrokeRec::Style fStyle
uint32_t SkColor
Definition: SkColor.h:37
constexpr SkColor SK_ColorBLACK
Definition: SkColor.h:103
SkPathFillType
Definition: SkPathTypes.h:11
#define SK_Scalar1
Definition: SkScalar.h:18
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
Definition: SkFont.h:35
@ kRound_Cap
adds circle
Definition: SkPaint.h:335
@ kButt_Cap
no stroke extension
Definition: SkPaint.h:334
@ kSquare_Cap
adds square
Definition: SkPaint.h:336
void setStyle(Style style)
Definition: SkPaint.cpp:105
void setColor(SkColor color)
Definition: SkPaint.cpp:119
void setAntiAlias(bool aa)
Definition: SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
@ kStrokeAndFill_Style
sets to stroke and fill geometry
Definition: SkPaint.h:195
@ kRound_Join
adds circle
Definition: SkPaint.h:360
@ kBevel_Join
connects outside edges
Definition: SkPaint.h:361
void setStrokeWidth(SkScalar width)
Definition: SkPaint.cpp:159
Definition: SkPath.h:59
void drawPath(SkPath &path, SkCanvas *canvas, SkColor color, const SkRect &clip, SkPaint::Cap cap, SkPaint::Join join, SkPaint::Style style, SkPathFillType fill, SkScalar strokeWidth)
Definition: quadpaths.cpp:162
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
sk_sp< SkTypeface > DefaultPortableTypeface()
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
font
Font Metadata and Metrics.
const char * fName
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static constexpr SkFontStyle gStyles[]
Definition: typeface.cpp:89

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