aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGAttribute.h
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-08-11 09:16:29 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-11 09:16:29 -0700
commit2d961e086bb40b371b1a667536fa089794847368 (patch)
tree89c6986af025e9d5c87791e4977838331bbd575b /experimental/svg/model/SkSVGAttribute.h
parent90b5cc31f373e831c942bfd3113b44486546846b (diff)
[SVGDom] Add more presentation attributes.
Implement proper presentation attribute inheritance, and add support for * fill-opacity * stroke-linecap * stroke-linejoin * stroke-opacity * stroke-width R=robertphillips@google.com,stephana@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2234153002 Review-Url: https://codereview.chromium.org/2234153002
Diffstat (limited to 'experimental/svg/model/SkSVGAttribute.h')
-rw-r--r--experimental/svg/model/SkSVGAttribute.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/experimental/svg/model/SkSVGAttribute.h b/experimental/svg/model/SkSVGAttribute.h
index 1d7c96eb22..4ac595d526 100644
--- a/experimental/svg/model/SkSVGAttribute.h
+++ b/experimental/svg/model/SkSVGAttribute.h
@@ -16,10 +16,15 @@ class SkSVGRenderContext;
enum class SkSVGAttribute {
kD,
kFill,
+ kFillOpacity,
kHeight,
kRx,
kRy,
kStroke,
+ kStrokeOpacity,
+ kStrokeLineCap,
+ kStrokeLineJoin,
+ kStrokeWidth,
kTransform,
kViewBox,
kWidth,
@@ -29,22 +34,19 @@ enum class SkSVGAttribute {
kUnknown,
};
-class SkSVGPresentationAttributes {
-public:
- SkSVGPresentationAttributes();
+struct SkSVGPresentationAttributes {
+ static SkSVGPresentationAttributes MakeInitial();
- void setFill(const SkSVGColorType&);
- void setStroke(const SkSVGColorType&);
+ // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhead.
- void applyTo(SkSVGRenderContext*) const;
+ SkTLazy<SkSVGPaint> fFill;
+ SkTLazy<SkSVGNumberType> fFillOpacity;
-private:
- // Color only for now.
- SkSVGColorType fFill;
- SkSVGColorType fStroke;
-
- unsigned fFillIsSet : 1;
- unsigned fStrokeIsSet : 1;
+ SkTLazy<SkSVGPaint> fStroke;
+ SkTLazy<SkSVGLineCap> fStrokeLineCap;
+ SkTLazy<SkSVGLineJoin> fStrokeLineJoin;
+ SkTLazy<SkSVGNumberType> fStrokeOpacity;
+ SkTLazy<SkSVGLength> fStrokeWidth;
};
#endif // SkSVGAttribute_DEFINED