diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 838a87c408610..f9f9aa77ca758 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -207,7 +207,10 @@ Scalar GaussianBlurFilterContents::CalculateScale(Scalar sigma) { if (sigma <= 4) { return 1.0; } - return 4.0 / sigma; + Scalar result = 4.0 / sigma; + // Round to the nearest 1/(2^n) to get the best quality down scaling. + Scalar rounded = pow(2.0f, round(log2(result))); + return rounded; }; std::optional GaussianBlurFilterContents::GetFilterSourceCoverage( diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index 6841439095d06..042c1baf2d425 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -987,7 +987,8 @@ TEST_P(EntityTest, Filters) { } TEST_P(EntityTest, GaussianBlurFilter) { - auto boston = CreateTextureForFixture("boston.jpg"); + auto boston = + CreateTextureForFixture("boston.jpg", /*enable_mipmapping=*/true); ASSERT_TRUE(boston); auto callback = [&](ContentContext& context, RenderPass& pass) -> bool {