diff options
-rw-r--r-- | src/gpu/effects/GrRectBlurEffect.fp | 13 | ||||
-rw-r--r-- | src/gpu/effects/GrRectBlurEffect.h | 10 | ||||
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.fp | 2 |
4 files changed, 19 insertions, 8 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp index fe5d59ed0b..d20f52b76e 100644 --- a/src/gpu/effects/GrRectBlurEffect.fp +++ b/src/gpu/effects/GrRectBlurEffect.fp @@ -7,6 +7,14 @@ in uniform float4 rect; in float sigma; in uniform sampler2D blurProfile; +@constructorParams { + GrSamplerState samplerParams +} + +@samplerParams(blurProfile) { + samplerParams +} + // in OpenGL ES, mediump floats have a minimum range of 2^14. If we have coordinates bigger than // that, the shader math will end up with infinities and result in the blur effect not working // correctly. To avoid this, we switch into highp when the coordinates are too big. As 2^14 is the @@ -75,8 +83,9 @@ uniform half profileSize; return nullptr; } - return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect(rect, sigma, - std::move(blurProfile))); + return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect( + rect, sigma, std::move(blurProfile), + GrSamplerState(GrSamplerState::WrapMode::kClamp, GrSamplerState::Filter::kBilerp))); } } diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h index 7a8bc2c005..688bb3d545 100644 --- a/src/gpu/effects/GrRectBlurEffect.h +++ b/src/gpu/effects/GrRectBlurEffect.h @@ -71,20 +71,22 @@ public: return nullptr; } - return std::unique_ptr<GrFragmentProcessor>( - new GrRectBlurEffect(rect, sigma, std::move(blurProfile))); + return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect( + rect, sigma, std::move(blurProfile), + GrSamplerState(GrSamplerState::WrapMode::kClamp, GrSamplerState::Filter::kBilerp))); } GrRectBlurEffect(const GrRectBlurEffect& src); std::unique_ptr<GrFragmentProcessor> clone() const override; const char* name() const override { return "RectBlurEffect"; } private: - GrRectBlurEffect(SkRect rect, float sigma, sk_sp<GrTextureProxy> blurProfile) + GrRectBlurEffect(SkRect rect, float sigma, sk_sp<GrTextureProxy> blurProfile, + GrSamplerState samplerParams) : INHERITED(kGrRectBlurEffect_ClassID, (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag) , fRect(rect) , fSigma(sigma) - , fBlurProfile(std::move(blurProfile)) { + , fBlurProfile(std::move(blurProfile), samplerParams) { this->addTextureSampler(&fBlurProfile); } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 595c5e6324..c0dec230f7 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -75,7 +75,7 @@ std::unique_ptr<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate( : GrSamplerState::Filter::kNearest); const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom); - return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix); + return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix, params); } #endif #endif diff --git a/src/gpu/effects/GrSimpleTextureEffect.fp b/src/gpu/effects/GrSimpleTextureEffect.fp index 9e9685f626..b5bc49fb97 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.fp +++ b/src/gpu/effects/GrSimpleTextureEffect.fp @@ -65,5 +65,5 @@ void main() { : GrSamplerState::Filter::kNearest); const SkMatrix& matrix = GrTest::TestMatrix(testData->fRandom); - return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix); + return GrSimpleTextureEffect::Make(testData->textureProxy(texIdx), matrix, params); } |