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

Commit 3467a9f

Browse files
committed
Aaron review
1 parent 485c5cf commit 3467a9f

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4563,30 +4563,26 @@ TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
45634563
// rectangle should be filled with opaque colors output by the blur.
45644564
>>>>>>> a178d2a245 (Center the clip over the blurred image)
45654565
TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
4566+
Canvas canvas;
4567+
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
4568+
Rect bounds =
4569+
Rect::MakeXYWH(0, 0, boston->GetSize().width, boston->GetSize().height);
4570+
Vector2 image_center = Vector2(bounds.GetSize() / 2);
45664571
Paint paint = {.image_filter =
45674572
ImageFilter::MakeBlur(Sigma(20.0), Sigma(20.0),
45684573
FilterContents::BlurStyle::kNormal,
45694574
Entity::TileMode::kDecal)};
4570-
4571-
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
4572-
auto bounds =
4573-
Rect::MakeXYWH(0, 0, boston->GetSize().width, boston->GetSize().height);
4574-
4575-
Vector2 scale = GetContentScale() * 0.5;
4576-
Vector2 pivot(450, 300);
4577-
Vector2 image_center = Vector2(bounds.GetSize() / 2);
4578-
4579-
Canvas canvas;
4580-
canvas.Scale(scale);
4581-
4582-
canvas.Translate(pivot);
4583-
canvas.ClipRect(Rect::MakeLTRB(-350, -150, 350, 150));
4584-
4585-
canvas.Translate(-pivot);
4575+
Vector2 clip_size = {150, 75};
4576+
Vector2 center = Vector2(1024, 768) / 2;
4577+
canvas.Scale(GetContentScale());
4578+
canvas.ClipRect(
4579+
Rect::MakeLTRB(center.x, center.y, center.x, center.y).Expand(clip_size));
4580+
canvas.Translate({center.x, center.y, 0});
4581+
canvas.Scale({0.6, 0.6, 1});
45864582
canvas.Rotate(Degrees(25));
4587-
canvas.PreConcat(Matrix::MakeTranslation(pivot * scale));
4588-
canvas.DrawImageRect(std::make_shared<Image>(boston), bounds,
4589-
bounds.Shift(-image_center), paint);
4583+
4584+
canvas.DrawImageRect(std::make_shared<Image>(boston), /*source=*/bounds,
4585+
/*dest=*/bounds.Shift(-image_center), paint);
45904586

45914587
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
45924588
}

0 commit comments

Comments
 (0)