diff options
author | Robert Phillips <robertphillips@google.com> | 2017-01-30 08:06:27 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-30 13:40:15 +0000 |
commit | 40fd7c94c24bb30d888c3d85a79cbb96c7fbf800 (patch) | |
tree | 075e886c01de864ba982910f1854f47ba1ae95d8 /src/gpu/effects/GrSimpleTextureEffect.h | |
parent | 55b72530fedeb58154635531751a8730982fbf2a (diff) |
Push GrTextureProxy down to more effects
Change-Id: Ie3f32a88f25af082c25bc6daf3fe24e303e80f9e
Reviewed-on: https://skia-review.googlesource.com/7616
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrSimpleTextureEffect.h')
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.h | 83 |
1 files changed, 22 insertions, 61 deletions
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index c44ce44121..64ca3cb8f5 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -13,29 +13,6 @@ class GrInvariantOutput; -// In a few places below we rely on braced initialization order being defined by the C++ spec (left -// to right). We use operator-> on a sk_sp and then in a later argument std::move() the sk_sp. GCC -// 4.9.0 and earlier has a bug where the left to right order evaluation isn't implemented correctly. -#if defined(__GNUC__) && !defined(__clang__) -# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -# if (GCC_VERSION > 40900) -# define GCC_EVAL_ORDER_BUG 0 -# else -# define GCC_EVAL_ORDER_BUG 1 -# endif -# undef GCC_VERSION -#else -# define GCC_EVAL_ORDER_BUG 0 -#endif - -#if GCC_EVAL_ORDER_BUG -# define PROXY_MOVE(X) (X) -#else -# define PROXY_MOVE(X) (std::move(X)) -#endif - -#undef GCC_EVAL_ORDER_BUG - /** * The output color of this effect is a modulation of the input color and a sample from a texture. * It allows explicit specification of the filtering and wrap modes (GrSamplerParams) and accepts @@ -52,23 +29,33 @@ public: GrSamplerParams::kNone_FilterMode)); } - static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy, + /* clamp mode */ + static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, sk_sp<GrColorSpaceXform> colorSpaceXform, - const SkMatrix& matrix) { + const SkMatrix& matrix, + GrSamplerParams::FilterMode filterMode) { return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(ctx, std::move(proxy), std::move(colorSpaceXform), matrix, - GrSamplerParams::kNone_FilterMode)); + new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, filterMode)); } - /* clamp mode */ static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - GrSamplerParams::FilterMode filterMode) { + const GrSamplerParams& p) { + return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), + matrix, p)); + } + + /* unfiltered, clamp mode */ + static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy, + sk_sp<GrColorSpaceXform> colorSpaceXform, + const SkMatrix& matrix) { return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), matrix, filterMode)); + new GrSimpleTextureEffect(ctx, std::move(proxy), std::move(colorSpaceXform), matrix, + GrSamplerParams::kNone_FilterMode)); } + /* clamp mode */ static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, @@ -78,14 +65,6 @@ public: matrix, filterMode)); } - static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, - sk_sp<GrColorSpaceXform> colorSpaceXform, - const SkMatrix& matrix, - const GrSamplerParams& p) { - return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, std::move(colorSpaceXform), - matrix, p)); - } - static sk_sp<GrFragmentProcessor> Make(GrContext* ctx, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, @@ -109,18 +88,6 @@ private: this->initClassID<GrSimpleTextureEffect>(); } - GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy, - sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - GrSamplerParams::FilterMode filterMode) - : INHERITED{ctx, - ModulationFlags(proxy->config()), - PROXY_MOVE(proxy), - std::move(colorSpaceXform), - matrix, - filterMode} { - this->initClassID<GrSimpleTextureEffect>(); - } - GrSimpleTextureEffect(GrTexture* texture, sk_sp<GrColorSpaceXform>colorSpaceXform, const SkMatrix& matrix, @@ -132,15 +99,11 @@ private: GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, - const GrSamplerParams& params) - : INHERITED{ctx, - ModulationFlags(proxy->config()), - PROXY_MOVE(proxy), - std::move(colorSpaceXform), - matrix, - params} { - this->initClassID<GrSimpleTextureEffect>(); - } + GrSamplerParams::FilterMode filterMode); + + GrSimpleTextureEffect(GrContext* ctx, sk_sp<GrTextureProxy> proxy, + sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, + const GrSamplerParams& params); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; @@ -155,6 +118,4 @@ private: typedef GrSingleTextureEffect INHERITED; }; -#undef PROXY_MOVE - #endif |