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

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

Issue 2235273003: [SVGDom] <polygon> & <polyline> support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: GN build fix 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/SkSVGAttributeParser.cpp ('k') | experimental/svg/model/SkSVGNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGDOM.cpp
diff --git a/experimental/svg/model/SkSVGDOM.cpp b/experimental/svg/model/SkSVGDOM.cpp
index 6e4bc49a9f803ad7138df33d990f62600fa4173c..4ae5fedd3e2d1ec0579af9ee696106a5d2347695 100644
--- a/experimental/svg/model/SkSVGDOM.cpp
+++ b/experimental/svg/model/SkSVGDOM.cpp
@@ -14,6 +14,7 @@
#include "SkSVGG.h"
#include "SkSVGNode.h"
#include "SkSVGPath.h"
+#include "SkSVGPoly.h"
#include "SkSVGRect.h"
#include "SkSVGRenderContext.h"
#include "SkSVGSVG.h"
@@ -122,6 +123,18 @@ bool SetLineJoinAttribute(const sk_sp<SkSVGNode>& node, SkSVGAttribute attr,
return true;
}
+bool SetPointsAttribute(const sk_sp<SkSVGNode>& node, SkSVGAttribute attr,
+ const char* stringValue) {
+ SkSVGPointsType points;
+ SkSVGAttributeParser parser(stringValue);
+ if (!parser.parsePoints(&points)) {
+ return false;
+ }
+
+ node->setAttribute(attr, SkSVGPointsValue(points));
+ return true;
+}
+
SkString TrimmedString(const char* first, const char* last) {
SkASSERT(first);
SkASSERT(last);
@@ -204,6 +217,7 @@ SortedDictionaryEntry<AttrParseInfo> gAttributeParseInfo[] = {
{ "fill" , { SkSVGAttribute::kFill , SetPaintAttribute }},
{ "fill-opacity" , { SkSVGAttribute::kFillOpacity , SetNumberAttribute }},
{ "height" , { SkSVGAttribute::kHeight , SetLengthAttribute }},
+ { "points" , { SkSVGAttribute::kPoints , SetPointsAttribute }},
{ "rx" , { SkSVGAttribute::kRx , SetLengthAttribute }},
{ "ry" , { SkSVGAttribute::kRy , SetLengthAttribute }},
{ "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute }},
@@ -220,10 +234,12 @@ SortedDictionaryEntry<AttrParseInfo> gAttributeParseInfo[] = {
};
SortedDictionaryEntry<sk_sp<SkSVGNode>(*)()> gTagFactories[] = {
- { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }},
- { "path", []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }},
- { "rect", []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); }},
- { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); }},
+ { "g" , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make(); }},
+ { "path" , []() -> sk_sp<SkSVGNode> { return SkSVGPath::Make(); }},
+ { "polygon" , []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolygon(); }},
+ { "polyline", []() -> sk_sp<SkSVGNode> { return SkSVGPoly::MakePolyline(); }},
+ { "rect" , []() -> sk_sp<SkSVGNode> { return SkSVGRect::Make(); }},
+ { "svg" , []() -> sk_sp<SkSVGNode> { return SkSVGSVG::Make(); }},
};
struct ConstructionContext {
« no previous file with comments | « experimental/svg/model/SkSVGAttributeParser.cpp ('k') | experimental/svg/model/SkSVGNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698