[Impeller] Add golden for Image ColorSource effect transform. (flutter/engine#49930)

Adds a golden to verify that Impeller behaves correctly for a variety of
effect transforms, entity (positional) transforms, and source rects.

Skia fiddle: https://fiddle.skia.org/c/6cdc5aefb291fda3833b806ca347a885

Skia (top) vs Impeller (bottom):

![Screenshot 2024-01-22 at 1 37
16 AM](https://github.com/flutter/engine/assets/919017/8b073f83-9821-4004-a56e-60e8946cefe7)
This commit is contained in:
Brandon DeRosier
2024-01-22 09:01:47 -08:00
committed by GitHub
parent 385b37a71c
commit 76a798ee20
3 changed files with 48 additions and 0 deletions

View File

@@ -3864,5 +3864,52 @@ TEST_P(AiksTest, GaussianBlurMipMapImageFilter) {
#endif
}
TEST_P(AiksTest, ImageColorSourceEffectTransform) {
// Compare with https://fiddle.skia.org/c/6cdc5aefb291fda3833b806ca347a885
Canvas canvas;
auto texture = CreateTextureForFixture("monkey.png");
canvas.DrawPaint({.color = Color::White()});
// Translation
{
Paint paint;
paint.color_source = ColorSource::MakeImage(
texture, Entity::TileMode::kRepeat, Entity::TileMode::kRepeat, {},
Matrix::MakeTranslation({50, 50}));
canvas.DrawRect(Rect::MakeLTRB(0, 0, 100, 100), paint);
}
// Rotation/skew
{
canvas.Save();
canvas.Rotate(Degrees(45));
Paint paint;
paint.color_source = ColorSource::MakeImage(
texture, Entity::TileMode::kRepeat, Entity::TileMode::kRepeat, {},
Matrix(1, -1, 0, 0, //
1, 1, 0, 0, //
0, 0, 1, 0, //
0, 0, 0, 1) //
);
canvas.DrawRect(Rect::MakeLTRB(100, 0, 200, 100), paint);
canvas.Restore();
}
// Scale
{
canvas.Translate(Vector2(100, 0));
canvas.Scale(Vector2(100, 100));
Paint paint;
paint.color_source = ColorSource::MakeImage(
texture, Entity::TileMode::kRepeat, Entity::TileMode::kRepeat, {},
Matrix::MakeScale(Vector2(0.005, 0.005)));
canvas.DrawRect(Rect::MakeLTRB(0, 0, 1, 1), paint);
}
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
} // namespace testing
} // namespace impeller

View File

@@ -88,6 +88,7 @@ test_fixtures("file_fixtures") {
"flutter_gpu_unlit.vert",
"flutter_logo_baked.glb",
"kalimba.jpg",
"monkey.png",
"multiple_stages.hlsl",
"nine_patch_corners.png",
"resources_limit.vert",

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB