| 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;
|
| +}
|
|
|