Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: experimental/svg/model/SkSVGNode.cpp

Issue 2243853003: [SVGDom] SVGPong sample app (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/svg/model/SkSVGNode.h ('k') | gyp/samples.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGNode.cpp
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp
index d60c984ceae6b6dd066a59ffaec423c229845832..a039b59ff16865a5df70c8c30e2bdac3f9f69262 100644
--- a/experimental/svg/model/SkSVGNode.cpp
+++ b/experimental/svg/model/SkSVGNode.cpp
@@ -33,28 +33,48 @@ void SkSVGNode::setAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
this->onSetAttribute(attr, v);
}
+void SkSVGNode::setFill(const SkSVGPaint& svgPaint) {
+ fPresentationAttributes.fFill.set(svgPaint);
+}
+
+void SkSVGNode::setFillOpacity(const SkSVGNumberType& opacity) {
+ fPresentationAttributes.fFillOpacity.set(
+ SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1)));
+}
+
+void SkSVGNode::setStroke(const SkSVGPaint& svgPaint) {
+ fPresentationAttributes.fStroke.set(svgPaint);
+}
+
+void SkSVGNode::setStrokeOpacity(const SkSVGNumberType& opacity) {
+ fPresentationAttributes.fStrokeOpacity.set(
+ SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1)));
+}
+
+void SkSVGNode::setStrokeWidth(const SkSVGLength& strokeWidth) {
+ fPresentationAttributes.fStrokeWidth.set(strokeWidth);
+}
+
void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
switch (attr) {
case SkSVGAttribute::kFill:
if (const SkSVGPaintValue* paint = v.as<SkSVGPaintValue>()) {
- fPresentationAttributes.fFill.set(*paint);
+ this->setFill(*paint);
}
break;
case SkSVGAttribute::kFillOpacity:
if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) {
- fPresentationAttributes.fFillOpacity.set(
- SkSVGNumberType(SkTPin<SkScalar>((*opacity)->value(), 0, 1)));
+ this->setFillOpacity(*opacity);
}
break;
case SkSVGAttribute::kStroke:
if (const SkSVGPaintValue* paint = v.as<SkSVGPaintValue>()) {
- fPresentationAttributes.fStroke.set(*paint);
+ this->setStroke(*paint);
}
break;
case SkSVGAttribute::kStrokeOpacity:
if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) {
- fPresentationAttributes.fStrokeOpacity.set(
- SkSVGNumberType(SkTPin<SkScalar>((*opacity)->value(), 0, 1)));
+ this->setStrokeOpacity(*opacity);
}
break;
case SkSVGAttribute::kStrokeLineCap:
@@ -69,7 +89,7 @@ void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
break;
case SkSVGAttribute::kStrokeWidth:
if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) {
- fPresentationAttributes.fStrokeWidth.set(*strokeWidth);
+ this->setStrokeWidth(*strokeWidth);
}
break;
default:
« no previous file with comments | « experimental/svg/model/SkSVGNode.h ('k') | gyp/samples.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698