[Impeller] Add golden for clipped+transformed blur. (flutter/engine#48886)
This is a simple golden intended to smoketest potential issues when applying the coverage hint in the blur. Expected results: 
This commit is contained in:
@@ -4555,5 +4555,34 @@ TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
// Smoketest to catch issues with the coverage hint.
|
||||
// Draws a rotated blurred image within a rectangle clip. The center of the clip
|
||||
// rectangle is the center of the rotated image. The entire area of the clip
|
||||
// rectangle should be filled with opaque colors output by the blur.
|
||||
TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
|
||||
Canvas canvas;
|
||||
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
|
||||
Rect bounds =
|
||||
Rect::MakeXYWH(0, 0, boston->GetSize().width, boston->GetSize().height);
|
||||
Vector2 image_center = Vector2(bounds.GetSize() / 2);
|
||||
Paint paint = {.image_filter =
|
||||
ImageFilter::MakeBlur(Sigma(20.0), Sigma(20.0),
|
||||
FilterContents::BlurStyle::kNormal,
|
||||
Entity::TileMode::kDecal)};
|
||||
Vector2 clip_size = {150, 75};
|
||||
Vector2 center = Vector2(1024, 768) / 2;
|
||||
canvas.Scale(GetContentScale());
|
||||
canvas.ClipRect(
|
||||
Rect::MakeLTRB(center.x, center.y, center.x, center.y).Expand(clip_size));
|
||||
canvas.Translate({center.x, center.y, 0});
|
||||
canvas.Scale({0.6, 0.6, 1});
|
||||
canvas.Rotate(Degrees(25));
|
||||
|
||||
canvas.DrawImageRect(std::make_shared<Image>(boston), /*source=*/bounds,
|
||||
/*dest=*/bounds.Shift(-image_center), paint);
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace impeller
|
||||
|
||||
Reference in New Issue
Block a user