Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSVGPath.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
14
15SkSVGPath::SkSVGPath() : INHERITED(SkSVGTag::kPath) { }
16
17bool SkSVGPath::parseAndSetAttribute(const char* n, const char* v) {
19 this->setPath(SkSVGAttributeParser::parse<SkPath>("d", n, v));
20}
21
22template <>
23bool SkSVGAttributeParser::parse<SkPath>(SkPath* path) {
24 return SkParsePath::FromSVGString(fCurPos, path);
25}
26
28 SkPathFillType fillType) const {
29 // the passed fillType follows inheritance rules and needs to be applied at draw time.
30 SkPath path = fPath; // Note: point and verb data are CoW
31 path.setFillType(fillType);
32 canvas->drawPath(path, paint);
33}
34
36 SkPath path = fPath;
37 // clip-rule can be inherited and needs to be applied at clip time.
38 path.setFillType(ctx.presentationContext().fInherited.fClipRule->asFillType());
39 this->mapToParent(&path);
40 return path;
41}
42
SkPath fPath
SkPathFillType
Definition SkPathTypes.h:11
#define INHERITED(method,...)
SkSVGTag
Definition SkSVGNode.h:23
void drawPath(const SkPath &path, const SkPaint &paint)
static bool FromSVGString(const char str[], SkPath *)
SkRect computeTightBounds() const
Definition SkPath.cpp:3378
SkPathFillType asFillType() const
Definition SkSVGTypes.h:361
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition SkSVGNode.cpp:90
void onDraw(SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const override
Definition SkSVGPath.cpp:27
SkPath onAsPath(const SkSVGRenderContext &) const override
Definition SkSVGPath.cpp:35
SkRect onObjectBoundingBox(const SkSVGRenderContext &) const override
Definition SkSVGPath.cpp:43
bool parseAndSetAttribute(const char *, const char *) override
Definition SkSVGPath.cpp:17
const SkSVGPresentationContext & presentationContext() const
void mapToParent(SkPath *) const
const Paint & paint
SkSVGProperty< SkSVGFillRule, true > fClipRule
SkSVGPresentationAttributes fInherited