[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): 
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
BIN
engine/src/flutter/impeller/fixtures/monkey.png
Normal file
BIN
engine/src/flutter/impeller/fixtures/monkey.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 603 KiB |
Reference in New Issue
Block a user