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: |
| 16 | ~SkSVGPath() override = default; |
| 17 | static sk_sp<SkSVGPath> Make() { return sk_sp<SkSVGPath>(new SkSVGPath()); } |
| 18 | |
| 19 | void setPath(const SkPath& path) { fPath = path; } |
| 20 | |
| 21 | protected: |
| 22 | void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
| 23 | |
| 24 | void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, |
| 25 | SkPathFillType) const override; |
| 26 | |
| 27 | SkPath onAsPath(const SkSVGRenderContext&) const override; |
| 28 | |
| 29 | private: |
| 30 | SkSVGPath(); |
| 31 | |
| 32 | mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types. |
| 33 | |
| 34 | using INHERITED = SkSVGShape; |
| 35 | }; |
| 36 | |
| 37 | #endif // SkSVGPath_DEFINED |