diff options
author | rmistry <rmistry@google.com> | 2015-08-28 17:16:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-28 17:16:50 -0700 |
commit | a511e6ad1042093bea5b015c22a920313fc57c0b (patch) | |
tree | 1ca21761acf027f31f3b02da6cfb3a700fe8d5e8 /include/core | |
parent | ecfdc251be71f3d634e76afdd6375bf55fc061aa (diff) |
Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (patchset #8 id:140001 of https://codereview.chromium.org/1316513002/ )
Reason for revert:
Primary suspect in failing DEPS rolls:
* https://codereview.chromium.org/1315753006
* https://codereview.chromium.org/1308323006
* https://codereview.chromium.org/1320903004
Primary suspect because the failing win bots did not fail in https://codereview.chromium.org/1315753005
Original issue's description:
> Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor*
>
> Committed: https://skia.googlesource.com/skia/+/ecfdc251be71f3d634e76afdd6375bf55fc061aa
TBR=joshualitt@google.com,wangyix@google.com,robertphillips@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1313573005
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkShader.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h index 8aaaf52047..47fdc9492f 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -334,20 +334,27 @@ public: /** - * Returns a GrFragmentProcessor that implements the shader for the GPU backend. NULL is - * returned if there is no GPU implementation. + * Returns true if the shader subclass succeeds in creating an effect or if none is required. + * False is returned if it fails or if there is not an implementation of this method in the + * shader subclass. * - * The GPU device does not call SkShader::createContext(), instead we pass the view matrix, - * local matrix, and filter quality directly. + * On success an implementation of this method must inspect the SkPaint and set paintColor to + * the color the effect expects as its input color. If the SkShader wishes to emit a solid + * color then it should set paintColor to that color and not create an effect. Note that + * GrColor is always premul. The common patterns are to convert paint's SkColor to GrColor or + * to extract paint's alpha and replicate it to all channels in paintColor. Upon failure + * paintColor should not be modified. It is not recommended to specialize the effect to + * the paint's color as then many GPU shaders may be generated. * - * The GrContext may be used by the to create textures that are required by the returned - * processor. + * The GrContext may be used by the effect to create textures. The GPU device does not + * call createContext. Instead we pass the SkPaint here in case the shader needs paint info. + * + * A view matrix is always required to create the correct GrFragmentProcessor. Some shaders + * may also use the optional localMatrix to define a matrix relevant only for sampling. */ - virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*, - const SkMatrix& viewMatric, - const SkMatrix* localMatrix, - SkFilterQuality, - GrProcessorDataManager*) const; + virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, + const SkMatrix* localMatrix, GrColor*, + GrProcessorDataManager*, GrFragmentProcessor**) const; /** * If the shader can represent its "average" luminance in a single color, return true and |