Index: experimental/svg/model/SkSVGAttributeParser.cpp |
diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp |
index 9d2d6b8136652db50d3288147eb57eb55a01705e..04b050828a25b423d082c252b11c22df22b523f0 100644 |
--- a/experimental/svg/model/SkSVGAttributeParser.cpp |
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp |
@@ -491,6 +491,29 @@ bool SkSVGAttributeParser::parseLineJoin(SkSVGLineJoin* join) { |
return parsedValue && this->parseEOSToken(); |
} |
+// https://www.w3.org/TR/SVG/pservers.html#LinearGradientElementSpreadMethodAttribute |
+bool SkSVGAttributeParser::parseSpreadMethod(SkSVGSpreadMethod* spread) { |
+ static const struct { |
+ SkSVGSpreadMethod::Type fType; |
+ const char* fName; |
+ } gSpreadInfo[] = { |
+ { SkSVGSpreadMethod::Type::kPad , "pad" }, |
+ { SkSVGSpreadMethod::Type::kReflect, "reflect" }, |
+ { SkSVGSpreadMethod::Type::kRepeat , "repeat" }, |
+ }; |
+ |
+ bool parsedValue = false; |
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gSpreadInfo); ++i) { |
+ if (this->parseExpectedStringToken(gSpreadInfo[i].fName)) { |
+ *spread = SkSVGSpreadMethod(gSpreadInfo[i].fType); |
+ parsedValue = true; |
+ break; |
+ } |
+ } |
+ |
+ return parsedValue && this->parseEOSToken(); |
+} |
+ |
// https://www.w3.org/TR/SVG/shapes.html#PolygonElementPointsAttribute |
bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) { |
SkTDArray<SkPoint> pts; |