[Impeller] When the blur sigma approaches zero, passthrough (flutter/engine#35423)

This commit is contained in:
Brandon DeRosier 2022-08-16 15:29:21 -07:00 committed by GitHub
parent 993488a28d
commit ed24407fca

View File

@ -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<Snapshot> 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;