2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkSVGRect_DEFINED
9 #define SkSVGRect_DEFINED
11 #include "modules/svg/include/SkSVGShape.h"
12 #include "modules/svg/include/SkSVGTypes.h"
16 class SkSVGRect final : public SkSVGShape {
18 static sk_sp<SkSVGRect> Make() { return sk_sp<SkSVGRect>(new SkSVGRect()); }
20 SVG_ATTR(X , SkSVGLength, SkSVGLength(0))
21 SVG_ATTR(Y , SkSVGLength, SkSVGLength(0))
22 SVG_ATTR(Width , SkSVGLength, SkSVGLength(0))
23 SVG_ATTR(Height, SkSVGLength, SkSVGLength(0))
25 SVG_OPTIONAL_ATTR(Rx, SkSVGLength)
26 SVG_OPTIONAL_ATTR(Ry, SkSVGLength)
29 bool parseAndSetAttribute(const char*, const char*) override;
31 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
32 SkPathFillType) const override;
34 SkPath onAsPath(const SkSVGRenderContext&) const override;
36 SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override;
41 SkRRect resolve(const SkSVGLengthContext&) const;
43 using INHERITED = SkSVGShape;
46 #endif // SkSVGRect_DEFINED