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

Commit 096def3

Browse files
authored
[Impeller] Add golden for clipped+transformed blur. (#48886)
This is a simple golden intended to smoketest potential issues when applying the coverage hint in the blur. Expected results: ![Screenshot 2023-12-11 at 12 03 50�PM](https://github.com/flutter/engine/assets/919017/251978b7-e6b4-4863-97f0-9a9a236f05ea)
1 parent a141712 commit 096def3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4555,5 +4555,34 @@ TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
45554555
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
45564556
}
45574557

4558+
// Smoketest to catch issues with the coverage hint.
4559+
// Draws a rotated blurred image within a rectangle clip. The center of the clip
4560+
// rectangle is the center of the rotated image. The entire area of the clip
4561+
// rectangle should be filled with opaque colors output by the blur.
4562+
TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
4563+
Canvas canvas;
4564+
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
4565+
Rect bounds =
4566+
Rect::MakeXYWH(0, 0, boston->GetSize().width, boston->GetSize().height);
4567+
Vector2 image_center = Vector2(bounds.GetSize() / 2);
4568+
Paint paint = {.image_filter =
4569+
ImageFilter::MakeBlur(Sigma(20.0), Sigma(20.0),
4570+
FilterContents::BlurStyle::kNormal,
4571+
Entity::TileMode::kDecal)};
4572+
Vector2 clip_size = {150, 75};
4573+
Vector2 center = Vector2(1024, 768) / 2;
4574+
canvas.Scale(GetContentScale());
4575+
canvas.ClipRect(
4576+
Rect::MakeLTRB(center.x, center.y, center.x, center.y).Expand(clip_size));
4577+
canvas.Translate({center.x, center.y, 0});
4578+
canvas.Scale({0.6, 0.6, 1});
4579+
canvas.Rotate(Degrees(25));
4580+
4581+
canvas.DrawImageRect(std::make_shared<Image>(boston), /*source=*/bounds,
4582+
/*dest=*/bounds.Shift(-image_center), paint);
4583+
4584+
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
4585+
}
4586+
45584587
} // namespace testing
45594588
} // namespace impeller

0 commit comments

Comments
 (0)