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

Unified Diff: experimental/svg/model/SkSVGAttributeParser.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.h ('k') | experimental/svg/model/SkSVGDOM.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGAttributeParser.cpp
diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp
index 308eb62ba6bbf7f51cde4b968fb98b02031c5bba..f8bfa2033f463a7664595731b748387a7a3cbff1 100644
--- a/experimental/svg/model/SkSVGAttributeParser.cpp
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp
@@ -427,3 +427,41 @@ bool SkSVGAttributeParser::parseLineJoin(SkSVGLineJoin* join) {
return parsedValue && this->parseEOSToken();
}
+
+// https://www.w3.org/TR/SVG/shapes.html#PolygonElementPointsAttribute
+bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
+ SkTDArray<SkPoint> pts;
+
+ bool parsedValue = false;
+ for (;;) {
+ this->parseWSToken();
+
+ SkScalar x, y;
+ if (!this->parseScalarToken(&x)) {
+ break;
+ }
+
+ // comma-wsp:
+ // (wsp+ comma? wsp*) | (comma wsp*)
+ bool wsp = this->parseWSToken();
+ bool comma = this->parseExpectedStringToken(",");
+ if (!(wsp || comma)) {
+ break;
+ }
+ this->parseWSToken();
+
+ if (!this->parseScalarToken(&y)) {
+ break;
+ }
+
+ pts.push(SkPoint::Make(x, y));
+ parsedValue = true;
+ }
+
+ if (parsedValue && this->parseEOSToken()) {
+ *points = pts;
+ return true;
+ }
+
+ return false;
+}
« no previous file with comments | « experimental/svg/model/SkSVGAttributeParser.h ('k') | experimental/svg/model/SkSVGDOM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698