• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkSVGShape.h"
12 #include "SkSVGTypes.h"
13 
14 struct SkRect;
15 
16 class SkSVGEllipse final : public SkSVGShape {
17 public:
18     ~SkSVGEllipse() override = default;
Make()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:
27     void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
28 
29     void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
30                 SkPath::FillType) const override;
31 
32     SkPath onAsPath(const SkSVGRenderContext&) const override;
33 
34 private:
35     SkSVGEllipse();
36 
37     SkRect resolve(const SkSVGLengthContext&) const;
38 
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
48