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

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

Issue 2337203002: [SVGDom] Linear gradient 'spreadMethod' support (Closed)
Patch Set: review Created 4 years, 3 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 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;
« 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