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 11 #include "modules/svg/include/SkSVGShape.h" 12 #include "modules/svg/include/SkSVGTypes.h" 13 14 struct SkRect; 15 16 class SkSVGEllipse final : public SkSVGShape { 17 public: Make()18 static sk_sp<SkSVGEllipse> Make() { return sk_sp<SkSVGEllipse>(new SkSVGEllipse()); } 19 20 SVG_ATTR(Cx, SkSVGLength, SkSVGLength(0)) 21 SVG_ATTR(Cy, SkSVGLength, SkSVGLength(0)) 22 SVG_ATTR(Rx, SkSVGLength, SkSVGLength(0)) 23 SVG_ATTR(Ry, SkSVGLength, SkSVGLength(0)) 24 25 protected: 26 bool parseAndSetAttribute(const char*, const char*) override; 27 28 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, 29 SkPathFillType) const override; 30 31 SkPath onAsPath(const SkSVGRenderContext&) const override; 32 33 private: 34 SkSVGEllipse(); 35 36 SkRect resolve(const SkSVGLengthContext&) const; 37 38 using INHERITED = SkSVGShape; 39 }; 40 41 #endif // SkSVGEllipse_DEFINED 42