Bundle SkShader::asFragmentProcessor arguments in a struct
The signature of this thing keeps changing (and is about to change again).
This just makes maintenance much easier.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2175563003
Review-Url: https://codereview.chromium.org/2175563003
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 1f80ea1..5301f46 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -311,6 +311,25 @@
virtual bool asACompose(ComposeRec*) const { return false; }
#if SK_SUPPORT_GPU
+ struct AsFPArgs {
+ AsFPArgs(GrContext* context,
+ const SkMatrix* viewMatrix,
+ const SkMatrix* localMatrix,
+ SkFilterQuality filterQuality,
+ SkSourceGammaTreatment gammaTreatment)
+ : fContext(context)
+ , fViewMatrix(viewMatrix)
+ , fLocalMatrix(localMatrix)
+ , fFilterQuality(filterQuality)
+ , fGammaTreatment(gammaTreatment) {}
+
+ GrContext* fContext;
+ const SkMatrix* fViewMatrix;
+ const SkMatrix* fLocalMatrix;
+ SkFilterQuality fFilterQuality;
+ SkSourceGammaTreatment fGammaTreatment;
+ };
+
/**
* Returns a GrFragmentProcessor that implements the shader for the GPU backend. NULL is
* returned if there is no GPU implementation.
@@ -324,11 +343,7 @@
* The returned GrFragmentProcessor should expect an unpremultiplied input color and
* produce a premultiplied output.
*/
- virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*,
- const SkMatrix& viewMatrix,
- const SkMatrix* localMatrix,
- SkFilterQuality,
- SkSourceGammaTreatment) const;
+ virtual sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const;
#endif
/**