Debian Codegraph @

modules/svg/include/SkSVGRect.h

raw
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 SkSVGRect_DEFINED
9 #define SkSVGRect_DEFINED
10
11 #include "include/core/SkPath.h"
12 #include "include/core/SkPathTypes.h"
13 #include "include/core/SkRect.h"
14 #include "include/core/SkRefCnt.h"
15 #include "include/private/base/SkAPI.h"
16 #include "modules/svg/include/SkSVGNode.h"
17 #include "modules/svg/include/SkSVGShape.h"
18 #include "modules/svg/include/SkSVGTypes.h"
19
20 class SkCanvas;
21 class SkPaint;
22 class SkRRect;
23 class SkSVGLengthContext;
24 class SkSVGRenderContext;
25
26 class SK_API SkSVGRect final : public SkSVGShape {
27 public:
28 static sk_sp<SkSVGRect> Make() { return sk_sp<SkSVGRect>(new SkSVGRect()); }
29
30 SVG_ATTR(X , SkSVGLength, SkSVGLength(0))
31 SVG_ATTR(Y , SkSVGLength, SkSVGLength(0))
32 SVG_ATTR(Width , SkSVGLength, SkSVGLength(0))
33 SVG_ATTR(Height, SkSVGLength, SkSVGLength(0))
34
35 SVG_OPTIONAL_ATTR(Rx, SkSVGLength)
36 SVG_OPTIONAL_ATTR(Ry, SkSVGLength)
37
38 protected:
39 bool parseAndSetAttribute(const char*, const char*) override;
40
41 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
42 SkPathFillType) const override;
43
44 SkPath onAsPath(const SkSVGRenderContext&) const override;
45
46 SkRect onTransformableObjectBoundingBox(const SkSVGRenderContext&) const override;
47
48 private:
49 SkSVGRect();
50
51 SkRRect resolve(const SkSVGLengthContext&) const;
52
53 using INHERITED = SkSVGShape;
54 };
55
56 #endif // SkSVGRect_DEFINED