Bundle common arguments to GrGradientEffect creation
I'm going to be adding more (to deal with color spaces), so trying to fix
this before it gets out of control.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2332213007
Committed: https://skia.googlesource.com/skia/+/f605c16a030d791a37f589e6bddd7158ba5d62cd
Review-Url: https://codereview.chromium.org/2332213007
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 98b621e..a93235d 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -351,11 +351,8 @@
public:
class GLSLLinearProcessor;
- static sk_sp<GrFragmentProcessor> Make(GrContext* ctx,
- const SkLinearGradient& shader,
- const SkMatrix& matrix,
- SkShader::TileMode tm) {
- return sk_sp<GrFragmentProcessor>(new GrLinearGradient(ctx, shader, matrix, tm));
+ static sk_sp<GrFragmentProcessor> Make(const CreateArgs& args) {
+ return sk_sp<GrFragmentProcessor>(new GrLinearGradient(args));
}
virtual ~GrLinearGradient() { }
@@ -363,11 +360,8 @@
const char* name() const override { return "Linear Gradient"; }
private:
- GrLinearGradient(GrContext* ctx,
- const SkLinearGradient& shader,
- const SkMatrix& matrix,
- SkShader::TileMode tm)
- : INHERITED(ctx, shader, matrix, tm) {
+ GrLinearGradient(const CreateArgs& args)
+ : INHERITED(args) {
this->initClassID<GrLinearGradient>();
}
@@ -467,8 +461,8 @@
}
matrix.postConcat(fPtsToUnit);
- sk_sp<GrFragmentProcessor> inner(
- GrLinearGradient::Make(args.fContext, *this, matrix, fTileMode));
+ sk_sp<GrFragmentProcessor> inner(GrLinearGradient::Make(
+ GrGradientEffect::CreateArgs(args.fContext, this, &matrix, fTileMode)));
return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
}