Fix minor mask blur issues (flutter/engine#149)
This commit is contained in:
committed by
Dan Field
parent
63aac1a68c
commit
fa9bf454e3
@@ -92,9 +92,7 @@ bool BorderMaskBlurFilterContents::RenderFilter(
|
||||
|
||||
VS::FrameInfo frame_info;
|
||||
frame_info.mvp = Matrix::MakeOrthographic(ISize(1, 1));
|
||||
auto scale = entity.GetTransformation().GetScale();
|
||||
frame_info.sigma_uv = Vector2(scale.x, scale.y) *
|
||||
Vector2(sigma_x_.sigma, sigma_y_.sigma).Abs() /
|
||||
frame_info.sigma_uv = Vector2(sigma_x_.sigma, sigma_y_.sigma).Abs() /
|
||||
input_snapshot->texture->GetSize();
|
||||
frame_info.src_factor = src_color_factor_;
|
||||
frame_info.inner_blur_factor = inner_blur_factor_;
|
||||
|
||||
@@ -33,7 +33,10 @@ const float kHalfSqrtTwo = 0.70710678118;
|
||||
|
||||
// Indefinite integral of the Gaussian function (with constant range 0->1).
|
||||
float GaussianIntegral(float x, float sigma) {
|
||||
return 0.5 + 0.5 * erf(x * (kHalfSqrtTwo / sigma));
|
||||
// ( 1 + erf( x * (sqrt(2) / (2 * sigma) ) ) / 2
|
||||
// Because this sigmoid is always > 1, we remap it (n * 1.07 - 0.07)
|
||||
// so that it always fades to zero before it reaches the blur radius.
|
||||
return 0.535 * erf(x * (kHalfSqrtTwo / sigma)) + 0.465;
|
||||
}
|
||||
|
||||
float BoxBlurMask(vec2 uv) {
|
||||
|
||||
Reference in New Issue
Block a user