Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 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 SkSVGPath_DEFINED |
| 9 | #define SkSVGPath_DEFINED |
| 10 | |
| 11 | #include "include/core/SkPath.h" |
| 12 | #include "modules/svg/include/SkSVGShape.h" |
| 13 | |
| 14 | class SkSVGPath final : public SkSVGShape { |
| 15 | public: |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 16 | static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); } |
| 17 | |
| 18 | void setPath(const SkPath& path) { fPath = path; } |
| 19 | |
| 20 | protected: |
| 21 | void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
| 22 | |
| 23 | void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, |
| 24 | SkPathFillType) const override; |
| 25 | |
| 26 | SkPath onAsPath(const SkSVGRenderContext&) const override; |
| 27 | |
Tyler Denniston | 3a92f77 | 2021-01-12 09:28:22 -0500 | [diff] [blame^] | 28 | SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; |
| 29 | |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 30 | private: |
| 31 | SkSVGPath(); |
| 32 | |
| 33 | mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types. |
| 34 | |
| 35 | using INHERITED = SkSVGShape; |
| 36 | }; |
| 37 | |
| 38 | #endif // SkSVGPath_DEFINED |