fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [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 SkSVGEllipse_DEFINED |
| 9 | #define SkSVGEllipse_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "experimental/svg/model/SkSVGShape.h" |
| 12 | #include "experimental/svg/model/SkSVGTypes.h" |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 13 | |
Florin Malita | ce8840e | 2016-12-08 09:26:47 -0500 | [diff] [blame] | 14 | struct SkRect; |
| 15 | |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 16 | class SkSVGEllipse final : public SkSVGShape { |
| 17 | public: |
Brian Salomon | d3b6597 | 2017-03-22 12:05:03 -0400 | [diff] [blame] | 18 | ~SkSVGEllipse() override = default; |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 19 | static sk_sp<SkSVGEllipse> Make() { return sk_sp<SkSVGEllipse>(new SkSVGEllipse()); } |
| 20 | |
| 21 | void setCx(const SkSVGLength&); |
| 22 | void setCy(const SkSVGLength&); |
| 23 | void setRx(const SkSVGLength&); |
| 24 | void setRy(const SkSVGLength&); |
| 25 | |
| 26 | protected: |
Florin Malita | f4403e7 | 2020-04-10 14:14:04 +0000 | [diff] [blame] | 27 | void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 28 | |
Florin Malita | e932d4b | 2016-12-01 13:35:11 -0500 | [diff] [blame] | 29 | void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, |
Mike Reed | 7d34dc7 | 2019-11-26 12:17:17 -0500 | [diff] [blame] | 30 | SkPathFillType) const override; |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 31 | |
Florin Malita | ce8840e | 2016-12-08 09:26:47 -0500 | [diff] [blame] | 32 | SkPath onAsPath(const SkSVGRenderContext&) const override; |
| 33 | |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 34 | private: |
| 35 | SkSVGEllipse(); |
| 36 | |
Florin Malita | ce8840e | 2016-12-08 09:26:47 -0500 | [diff] [blame] | 37 | SkRect resolve(const SkSVGLengthContext&) const; |
| 38 | |
fmalita | dc4c2a9 | 2016-08-16 15:38:51 -0700 | [diff] [blame] | 39 | SkSVGLength fCx = SkSVGLength(0); |
| 40 | SkSVGLength fCy = SkSVGLength(0); |
| 41 | SkSVGLength fRx = SkSVGLength(0); |
| 42 | SkSVGLength fRy = SkSVGLength(0); |
| 43 | |
| 44 | typedef SkSVGShape INHERITED; |
| 45 | }; |
| 46 | |
| 47 | #endif // SkSVGEllipse_DEFINED |