Flutter Engine
The Flutter Engine
SkSVGPoly.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
12#include "src/base/SkTLazy.h"
13
14SkSVGPoly::SkSVGPoly(SkSVGTag t) : INHERITED(t) {}
15
16bool SkSVGPoly::parseAndSetAttribute(const char* n, const char* v) {
18 return true;
19 }
20
21 if (this->setPoints(SkSVGAttributeParser::parse<SkSVGPointsType>("points", n, v))) {
22 // TODO: we can likely just keep the points array and create the SkPath when needed.
23 fPath = SkPath::Polygon(
24 fPoints.data(), fPoints.size(),
25 this->tag() == SkSVGTag::kPolygon); // only polygons are auto-closed
26 }
27
28 // No other attributes on this node
29 return false;
30}
31
33 SkPathFillType fillType) const {
34 // the passed fillType follows inheritance rules and needs to be applied at draw time.
35 fPath.setFillType(fillType);
36 canvas->drawPath(fPath, paint);
37}
38
40 SkPath path = fPath;
41
42 // clip-rule can be inherited and needs to be applied at clip time.
44
45 this->mapToParent(&path);
46 return path;
47}
48
50 return fPath.getBounds();
51}
SkPathFillType
Definition: SkPathTypes.h:11
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
SkSVGTag
Definition: SkSVGNode.h:23
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
Definition: SkPath.h:59
void setFillType(SkPathFillType ft)
Definition: SkPath.h:235
const SkRect & getBounds() const
Definition: SkPath.cpp:430
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition: SkPath.cpp:3614
SkPathFillType asFillType() const
Definition: SkSVGTypes.h:361
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition: SkSVGNode.cpp:90
SkRect onObjectBoundingBox(const SkSVGRenderContext &) const override
Definition: SkSVGPoly.cpp:49
void onDraw(SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const override
Definition: SkSVGPoly.cpp:32
SkPath onAsPath(const SkSVGRenderContext &) const override
Definition: SkSVGPoly.cpp:39
bool parseAndSetAttribute(const char *, const char *) override
Definition: SkSVGPoly.cpp:16
const SkSVGPresentationContext & presentationContext() const
void mapToParent(SkPath *) const
const Paint & paint
Definition: color_source.cc:38
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
SkSVGProperty< SkSVGFillRule, true > fClipRule
SkSVGPresentationAttributes fInherited