diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 47dadff5c895a..3e4acc30f7e05 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -226,14 +226,13 @@ std::optional DirectionalGaussianBlurFilterContents::RenderFilter( }; Vector2 scale; + auto scale_curve = [](Scalar radius) { return std::min(1.0, 2.0 / radius); }; { - scale.x = - 1.0 / - std::ceil(std::log2(std::max(2.0f, transformed_blur_radius_length))); + scale.x = scale_curve(transformed_blur_radius_length); Scalar y_radius = std::abs(pass_transform.GetDirectionScale(Vector2( 0, source_override_ ? Radius{secondary_blur_sigma_}.radius : 1))); - scale.y = 1.0 / std::ceil(std::log2(std::max(2.0f, y_radius))); + scale.y = scale_curve(y_radius); } Vector2 scaled_size = pass_texture_rect.size * scale; diff --git a/impeller/geometry/geometry_unittests.cc b/impeller/geometry/geometry_unittests.cc index 0957acf76b23a..c1c92f37e500f 100644 --- a/impeller/geometry/geometry_unittests.cc +++ b/impeller/geometry/geometry_unittests.cc @@ -229,7 +229,7 @@ TEST(GeometryTest, MatrixTransformDirection) { } { - auto matrix = Matrix::MakeTranslation({100, 100, 100}) * + auto matrix = Matrix::MakeTranslation({0, -0.4, 100}) * Matrix::MakeRotationZ(Radians{kPiOver2}) * Matrix::MakeScale({2.0, 2.0, 2.0}); auto vector = Point(10, 20); diff --git a/impeller/geometry/matrix.h b/impeller/geometry/matrix.h index 29bbb949b3918..9be6707f08503 100644 --- a/impeller/geometry/matrix.h +++ b/impeller/geometry/matrix.h @@ -249,7 +249,7 @@ struct Matrix { } constexpr Scalar GetDirectionScale(Vector3 direction) const { - return 1.0 / (this->Invert() * direction.Normalize()).Length() * + return 1.0 / (this->Basis().Invert() * direction.Normalize()).Length() * direction.Length(); }