1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2016 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#ifndef SkSVGLine_DEFINED
9cb93a386Sopenharmony_ci#define SkSVGLine_DEFINED
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#include "modules/svg/include/SkSVGShape.h"
12cb93a386Sopenharmony_ci#include "modules/svg/include/SkSVGTypes.h"
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_cistruct SkPoint;
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciclass SkSVGLine final : public SkSVGShape {
17cb93a386Sopenharmony_cipublic:
18cb93a386Sopenharmony_ci    static sk_sp<SkSVGLine> Make() { return sk_sp<SkSVGLine>(new SkSVGLine()); }
19cb93a386Sopenharmony_ci
20cb93a386Sopenharmony_ci    SVG_ATTR(X1, SkSVGLength, SkSVGLength(0))
21cb93a386Sopenharmony_ci    SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0))
22cb93a386Sopenharmony_ci    SVG_ATTR(X2, SkSVGLength, SkSVGLength(0))
23cb93a386Sopenharmony_ci    SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0))
24cb93a386Sopenharmony_ci
25cb93a386Sopenharmony_ciprotected:
26cb93a386Sopenharmony_ci    bool parseAndSetAttribute(const char*, const char*) override;
27cb93a386Sopenharmony_ci
28cb93a386Sopenharmony_ci    void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
29cb93a386Sopenharmony_ci                SkPathFillType) const override;
30cb93a386Sopenharmony_ci
31cb93a386Sopenharmony_ci    SkPath onAsPath(const SkSVGRenderContext&) const override;
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ciprivate:
34cb93a386Sopenharmony_ci    SkSVGLine();
35cb93a386Sopenharmony_ci
36cb93a386Sopenharmony_ci    // resolve and return the two endpoints
37cb93a386Sopenharmony_ci    std::tuple<SkPoint, SkPoint> resolve(const SkSVGLengthContext&) const;
38cb93a386Sopenharmony_ci
39cb93a386Sopenharmony_ci    using INHERITED = SkSVGShape;
40cb93a386Sopenharmony_ci};
41cb93a386Sopenharmony_ci
42cb93a386Sopenharmony_ci#endif // SkSVGLine_DEFINED
43