/src/skia/modules/svg/include/SkSVGRect.h
Line | Count | Source |
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 | | |
8 | | #ifndef SkSVGRect_DEFINED |
9 | | #define SkSVGRect_DEFINED |
10 | | |
11 | | #include "include/core/SkPath.h" |
12 | | #include "include/core/SkRect.h" |
13 | | #include "include/core/SkRefCnt.h" |
14 | | #include "include/private/base/SkAPI.h" |
15 | | #include "modules/svg/include/SkSVGNode.h" |
16 | | #include "modules/svg/include/SkSVGShape.h" |
17 | | #include "modules/svg/include/SkSVGTypes.h" |
18 | | #include "src/base/SkTLazy.h" |
19 | | |
20 | | class SkCanvas; |
21 | | class SkPaint; |
22 | | class SkRRect; |
23 | | class SkSVGLengthContext; |
24 | | class SkSVGRenderContext; |
25 | | enum class SkPathFillType; |
26 | | |
27 | | class SK_API SkSVGRect final : public SkSVGShape { |
28 | | public: |
29 | 29 | static sk_sp<SkSVGRect> Make() { return sk_sp<SkSVGRect>(new SkSVGRect()); } |
30 | | |
31 | | SVG_ATTR(X , SkSVGLength, SkSVGLength(0)) |
32 | | SVG_ATTR(Y , SkSVGLength, SkSVGLength(0)) |
33 | | SVG_ATTR(Width , SkSVGLength, SkSVGLength(0)) |
34 | | SVG_ATTR(Height, SkSVGLength, SkSVGLength(0)) |
35 | | |
36 | | SVG_OPTIONAL_ATTR(Rx, SkSVGLength) |
37 | | SVG_OPTIONAL_ATTR(Ry, SkSVGLength) |
38 | | |
39 | | protected: |
40 | | bool parseAndSetAttribute(const char*, const char*) override; |
41 | | |
42 | | void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, |
43 | | SkPathFillType) const override; |
44 | | |
45 | | SkPath onAsPath(const SkSVGRenderContext&) const override; |
46 | | |
47 | | SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; |
48 | | |
49 | | private: |
50 | | SkSVGRect(); |
51 | | |
52 | | SkRRect resolve(const SkSVGLengthContext&) const; |
53 | | |
54 | | using INHERITED = SkSVGShape; |
55 | | }; |
56 | | |
57 | | #endif // SkSVGRect_DEFINED |