Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d0403fb

Browse files
committed
started only bumping padding if we had it
1 parent 633a4d9 commit d0403fb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

impeller/entity/contents/filters/gaussian_blur_filter_contents.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,24 @@ DownsamplePassArgs CalculateDownsamplePassArgs(
288288
Rect source_rect_padded = source_rect.Expand(padding);
289289
Vector2 downsampled_size = source_rect_padded.GetSize() * downsample_scalar;
290290
ISize subpass_size =
291-
ISize(round(downsampled_size.x), round(downsampled_size.y));
291+
ISize(ceil(downsampled_size.x), ceil(downsampled_size.y));
292+
Vector2 divisible_size(CeilToDivisible(source_rect_padded.GetSize().width,
293+
1.0 / downsample_scalar.x),
294+
CeilToDivisible(source_rect_padded.GetSize().height,
295+
1.0 / downsample_scalar.y));
296+
// Only make the padding divisible if we already have padding. If we don't
297+
// have padding adding more can add artifacts to hard blur edges.
298+
Vector2 divisible_padding(
299+
padding.x > 0
300+
? padding.x +
301+
(divisible_size.x - source_rect_padded.GetSize().width) / 2.0
302+
: 0.f,
303+
padding.y > 0
304+
? padding.y +
305+
(divisible_size.y - source_rect_padded.GetSize().height) / 2.0
306+
: 0.f);
307+
source_rect_padded = source_rect.Expand(divisible_padding);
308+
292309
Vector2 effective_scalar =
293310
Vector2(subpass_size) / source_rect_padded.GetSize();
294311
Quad uvs = GaussianBlurFilterContents::CalculateUVs(

0 commit comments

Comments
 (0)