diff options
author | brianosman <brianosman@google.com> | 2016-07-22 11:04:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-22 11:04:53 -0700 |
commit | 839345d63466a4209a0985654ec033624821fd78 (patch) | |
tree | 71590a11b99b3b554a4c80096f36c759b5d68ced /include | |
parent | 8a8accbcd1958c1646246b9b994fb47a3b5a6021 (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkShader.h | 25 | ||||
-rw-r--r-- | include/effects/SkPerlinNoiseShader.h | 4 |
2 files changed, 21 insertions, 8 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h index 1f80ea1c09..5301f46a0a 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -311,6 +311,25 @@ public: 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 @@ public: * 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 /** diff --git a/include/effects/SkPerlinNoiseShader.h b/include/effects/SkPerlinNoiseShader.h index ed706c19e8..60dc53a6a2 100644 --- a/include/effects/SkPerlinNoiseShader.h +++ b/include/effects/SkPerlinNoiseShader.h @@ -102,9 +102,7 @@ public: }; #if SK_SUPPORT_GPU - sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext* context, const SkMatrix& viewM, - const SkMatrix*, SkFilterQuality, - SkSourceGammaTreatment) const override; + sk_sp<GrFragmentProcessor> asFragmentProcessor(const AsFPArgs&) const override; #endif SK_TO_STRING_OVERRIDE() |