[Impeller] Limit blur kernel to 1000x1000 pixels (flutter/engine#42154)
Resolves https://github.com/flutter/flutter/issues/127151. This is the same internal limit that Skia uses.
This commit is contained in:
@@ -2286,6 +2286,22 @@ TEST_P(AiksTest, CanRenderBackdropBlur) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_P(AiksTest, CanRenderBackdropBlurHugeSigma) {
|
||||
Canvas canvas;
|
||||
canvas.DrawCircle({400, 400}, 300, {.color = Color::Green()});
|
||||
canvas.SaveLayer({.blend_mode = BlendMode::kSource}, std::nullopt,
|
||||
[](const FilterInput::Ref& input,
|
||||
const Matrix& effect_transform, bool is_subpass) {
|
||||
return FilterContents::MakeGaussianBlur(
|
||||
input, Sigma(999999), Sigma(999999),
|
||||
FilterContents::BlurStyle::kNormal,
|
||||
Entity::TileMode::kClamp, effect_transform);
|
||||
});
|
||||
canvas.Restore();
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/126701 .
|
||||
TEST_P(AiksTest, CanRenderClippedRuntimeEffects) {
|
||||
if (GetParam() != PlaygroundBackend::kMetal) {
|
||||
|
||||
@@ -101,7 +101,8 @@ std::optional<Entity> DirectionalGaussianBlurFilterContents::RenderFilter(
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto radius = Radius{blur_sigma_}.radius;
|
||||
// Limit the kernel size to 1000x1000 pixels, like Skia does.
|
||||
auto radius = std::min(Radius{blur_sigma_}.radius, 500.0f);
|
||||
|
||||
// Input 0 snapshot.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user