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

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

Issue 2339533002: [SVGDom] Linear gradient 'gradientTransform' support (Closed)
Patch Set: rebased 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/SkSVGLinearGradient.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGLinearGradient.cpp
diff --git a/experimental/svg/model/SkSVGLinearGradient.cpp b/experimental/svg/model/SkSVGLinearGradient.cpp
index 289c5e327602c615e984e38716eb3c12c8a24439..4bbed1c354c2843be2497dde43400148dbca630e 100644
--- a/experimental/svg/model/SkSVGLinearGradient.cpp
+++ b/experimental/svg/model/SkSVGLinearGradient.cpp
@@ -17,6 +17,10 @@ void SkSVGLinearGradient::setHref(const SkSVGStringType& href) {
fHref = std::move(href);
}
+void SkSVGLinearGradient::setGradientTransform(const SkSVGTransformType& t) {
+ fGradientTransform = t;
+}
+
void SkSVGLinearGradient::setSpreadMethod(const SkSVGSpreadMethod& spread) {
fSpreadMethod = spread;
}
@@ -39,6 +43,11 @@ void SkSVGLinearGradient::setY2(const SkSVGLength& y2) {
void SkSVGLinearGradient::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
switch (attr) {
+ case SkSVGAttribute::kGradientTransform:
+ if (const auto* t = v.as<SkSVGTransformValue>()) {
+ this->setGradientTransform(*t);
+ }
+ break;
case SkSVGAttribute::kHref:
if (const auto* href = v.as<SkSVGStringValue>()) {
this->setHref(*href);
@@ -130,6 +139,6 @@ bool SkSVGLinearGradient::onAsPaint(const SkSVGRenderContext& ctx, SkPaint* pain
const auto tileMode = static_cast<SkShader::TileMode>(fSpreadMethod.type());
paint->setShader(SkGradientShader::MakeLinear(pts, colors.begin(), pos.begin(), colors.count(),
- tileMode));
+ tileMode, 0, &fGradientTransform.value()));
return true;
}
« no previous file with comments | « experimental/svg/model/SkSVGLinearGradient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698