diff options
author | Mike Reed <reed@google.com> | 2018-01-19 14:03:47 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-19 19:39:16 +0000 |
commit | a99b39399522658d7e5ddee97d0e45aa9fceaf89 (patch) | |
tree | 7c4cdcee7ecf4b152933382604793daa94f95b1b /include/core | |
parent | c22e50bd317fe3658445c04e18a6e319d746c510 (diff) |
use GrFPArgs for maskfilters
Bug: skia:
Change-Id: I8516a3b0f6d8301c51f0861c65b9fe8f692fc5e5
Reviewed-on: https://skia-review.googlesource.com/97260
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkMaskFilter.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h index 1714d17bca..3e10dc9ad3 100644 --- a/include/core/SkMaskFilter.h +++ b/include/core/SkMaskFilter.h @@ -6,7 +6,6 @@ * found in the LICENSE file. */ - #ifndef SkMaskFilter_DEFINED #define SkMaskFilter_DEFINED @@ -18,6 +17,7 @@ class GrClip; class GrContext; +struct GrFPArgs; class GrRenderTargetContext; class GrPaint; class GrFragmentProcessor; @@ -69,16 +69,18 @@ public: #if SK_SUPPORT_GPU /** - * Returns true if the filter can be expressed a single-pass GrProcessor without requiring an - * explicit input mask. Per-pixel, the effect receives the incoming mask's coverage as - * the input color and outputs the filtered covereage value. This means that each pixel's - * filtered coverage must only depend on the unfiltered mask value for that pixel and not on - * surrounding values. - * - * If effect is non-NULL, a new GrProcessor instance is stored in it. The caller assumes - * ownership of the effect and must unref it. + * Returns a processor if the filter can be expressed a single-pass GrProcessor without + * requiring an explicit input mask. Per-pixel, the effect receives the incoming mask's + * coverage as the input color and outputs the filtered covereage value. This means that each + * pixel's filtered coverage must only depend on the unfiltered mask value for that pixel and + * not on surrounding values. + */ + std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs& args) const; + + /** + * Returns true iff asFragmentProcessor() will return a processor */ - virtual bool asFragmentProcessor(GrFragmentProcessor**) const { return false; } + bool hasFragmentProcessor() const; /** * If asFragmentProcessor() fails the filter may be implemented on the GPU by a subclass @@ -179,6 +181,11 @@ public: protected: SkMaskFilter() {} +#if SK_SUPPORT_GPU + virtual std::unique_ptr<GrFragmentProcessor> onAsFragmentProcessor(const GrFPArgs&) const; + virtual bool onHasFragmentProcessor() const; +#endif + enum FilterReturn { kFalse_FilterReturn, kTrue_FilterReturn, |