This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
impeller/entity/contents/filters Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 2323
2424namespace impeller {
2525
26+ // This function was derived with polynomial regression when comparing the
27+ // results with Skia. Changing the curve below should invalidate this.
28+ //
29+ // The following data points were used:
30+ // 0 | 1
31+ // 75 | 0.8
32+ // 150 | 0.5
33+ // 300 | 0.22
34+ // 400 | 0.2
35+ // 500 | 0.15
36+ Sigma ScaleSigma (Sigma sigma) {
37+ // Limit the kernel size to 1000x1000 pixels, like Skia does.
38+ Scalar clamped = std::min (sigma.sigma , 500 .0f );
39+ Scalar scalar = 1.02 - 3.89e-3 * clamped + 4.36e-06 * clamped * clamped;
40+ return Sigma (clamped * scalar);
41+ }
42+
2643DirectionalGaussianBlurFilterContents::DirectionalGaussianBlurFilterContents () =
2744 default ;
2845
@@ -76,8 +93,7 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
7693 return std::nullopt ;
7794 }
7895
79- // Limit the kernel size to 1000x1000 pixels, like Skia does.
80- auto radius = std::min (Radius{blur_sigma_}.radius , 500 .0f );
96+ auto radius = Radius{ScaleSigma (blur_sigma_)}.radius ;
8197
8298 auto transform = entity.GetTransformation () * effect_transform.Basis ();
8399 auto transformed_blur_radius =
You can’t perform that action at this time.
0 commit comments