From ed24407fca00406f167ccbdf36fce60c19308020 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Tue, 16 Aug 2022 15:29:21 -0700 Subject: [PATCH] [Impeller] When the blur sigma approaches zero, passthrough (flutter/engine#35423) --- .../filters/gaussian_blur_filter_contents.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 43b53d702a2..9c3034ff364 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -27,14 +27,6 @@ DirectionalGaussianBlurFilterContents:: ~DirectionalGaussianBlurFilterContents() = default; void DirectionalGaussianBlurFilterContents::SetSigma(Sigma sigma) { - if (sigma.sigma < kEhCloseEnough) { - // This cutoff is an implementation detail of the blur that's tied to the - // fragment shader. When the blur is set to 0, having a value slightly above - // zero makes the shader do 1 finite sample to pass the image through with - // no blur (while retaining correct alpha mask behavior). - blur_sigma_ = Sigma{kEhCloseEnough}; - return; - } blur_sigma_ = sigma; } @@ -105,6 +97,10 @@ std::optional DirectionalGaussianBlurFilterContents::RenderFilter( return std::nullopt; } + if (blur_sigma_.sigma < kEhCloseEnough) { + return input_snapshot.value(); // No blur to render. + } + auto maybe_input_uvs = input_snapshot->GetCoverageUVs(coverage); if (!maybe_input_uvs.has_value()) { return std::nullopt;