Flutter Engine
The Flutter Engine
SkSVGLine.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
13SkSVGLine::SkSVGLine() : INHERITED(SkSVGTag::kLine) {}
14
15bool SkSVGLine::parseAndSetAttribute(const char* n, const char* v) {
17 this->setX1(SkSVGAttributeParser::parse<SkSVGLength>("x1", n, v)) ||
18 this->setY1(SkSVGAttributeParser::parse<SkSVGLength>("y1", n, v)) ||
19 this->setX2(SkSVGAttributeParser::parse<SkSVGLength>("x2", n, v)) ||
20 this->setY2(SkSVGAttributeParser::parse<SkSVGLength>("y2", n, v));
21}
22
23std::tuple<SkPoint, SkPoint> SkSVGLine::resolve(const SkSVGLengthContext& lctx) const {
24 return std::make_tuple(
29}
30
32 const SkPaint& paint, SkPathFillType) const {
33 SkPoint p0, p1;
34 std::tie(p0, p1) = this->resolve(lctx);
35
36 canvas->drawLine(p0, p1, paint);
37}
38
40 SkPoint p0, p1;
41 std::tie(p0, p1) = this->resolve(ctx.lengthContext());
42
43 SkPath path = SkPath::Line(p0, p1);
44 this->mapToParent(&path);
45
46 return path;
47}
SkPathFillType
Definition: SkPathTypes.h:11
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
SkSVGTag
Definition: SkSVGNode.h:23
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
Definition: SkCanvas.cpp:2700
Definition: SkPath.h:59
static SkPath Line(const SkPoint a, const SkPoint b)
Definition: SkPath.h:106
SkScalar resolve(const SkSVGLength &, LengthType) const
SkPath onAsPath(const SkSVGRenderContext &) const override
Definition: SkSVGLine.cpp:39
void onDraw(SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const override
Definition: SkSVGLine.cpp:31
bool parseAndSetAttribute(const char *, const char *) override
Definition: SkSVGLine.cpp:15
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition: SkSVGNode.cpp:90
const SkSVGLengthContext & lengthContext() 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
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173