diff options
author | fmalita <fmalita@chromium.org> | 2016-08-03 10:21:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-03 10:21:11 -0700 |
commit | bffc2566872f99d378a1113d0a49ec9ee0d60b7a (patch) | |
tree | 3a7fab8b6206e99201b1ea817c95454f340260c8 /experimental/svg/model/SkSVGRect.h | |
parent | 9e3d3d8b363edcdd81a13b2be046152c6bb839cd (diff) |
[SVGDom] Initial SVGLength support
Mostly plumb new length types, but also introduce a stateful parser,
rect shape and named color support.
R=reed@google.com,robertphillips@google.com,stephana@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2202053002
Review-Url: https://codereview.chromium.org/2202053002
Diffstat (limited to 'experimental/svg/model/SkSVGRect.h')
-rw-r--r-- | experimental/svg/model/SkSVGRect.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGRect.h b/experimental/svg/model/SkSVGRect.h new file mode 100644 index 0000000000..b4cd363d77 --- /dev/null +++ b/experimental/svg/model/SkSVGRect.h @@ -0,0 +1,40 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkSVGRect_DEFINED +#define SkSVGRect_DEFINED + +#include "SkSVGShape.h" +#include "SkSVGTypes.h" + +class SkSVGRect final : public SkSVGShape { +public: + virtual ~SkSVGRect() = default; + static sk_sp<SkSVGRect> Make() { return sk_sp<SkSVGRect>(new SkSVGRect()); } + + void setX(const SkSVGLength&); + void setY(const SkSVGLength&); + void setWidth(const SkSVGLength&); + void setHeight(const SkSVGLength&); + +protected: + void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; + + void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&) const override; + +private: + SkSVGRect(); + + SkSVGLength fX = SkSVGLength(0); + SkSVGLength fY = SkSVGLength(0); + SkSVGLength fWidth = SkSVGLength(0); + SkSVGLength fHeight = SkSVGLength(0); + + typedef SkSVGShape INHERITED; +}; + +#endif // SkSVGRect_DEFINED |