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

Commit 9407053

Browse files
[Impeller] move draw vertices to dl unittests. (#53400)
Part of flutter/flutter#142054 Moves all of the drawVertices tests for aiks and entities into DL. This might change some of the entity goldens but ... these are easy to eyeball so it should be fine IMO.
1 parent 8a8f285 commit 9407053

File tree

6 files changed

+384
-315
lines changed

6 files changed

+384
-315
lines changed

ci/licenses_golden/excluded_files

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
../../../flutter/impeller/display_list/aiks_dl_gradient_unittests.cc
146146
../../../flutter/impeller/display_list/aiks_dl_opacity_unittests.cc
147147
../../../flutter/impeller/display_list/aiks_dl_path_unittests.cc
148+
../../../flutter/impeller/display_list/aiks_dl_vertices_unittests.cc
148149
../../../flutter/impeller/display_list/dl_golden_blur_unittests.cc
149150
../../../flutter/impeller/display_list/dl_golden_unittests.cc
150151
../../../flutter/impeller/display_list/dl_golden_unittests.h

impeller/aiks/aiks_unittests.cc

-110
Original file line numberDiff line numberDiff line change
@@ -2445,116 +2445,6 @@ TEST_P(AiksTest, ReleasesTextureOnTeardown) {
24452445
"released.";
24462446
}
24472447

2448-
// Regression test for https://github.com/flutter/flutter/issues/135441 .
2449-
TEST_P(AiksTest, VerticesGeometryUVPositionData) {
2450-
Canvas canvas;
2451-
Paint paint;
2452-
auto texture = CreateTextureForFixture("table_mountain_nx.png");
2453-
2454-
paint.color_source = ColorSource::MakeImage(texture, Entity::TileMode::kClamp,
2455-
Entity::TileMode::kClamp, {}, {});
2456-
2457-
auto vertices = {Point(0, 0), Point(texture->GetSize().width, 0),
2458-
Point(0, texture->GetSize().height)};
2459-
std::vector<uint16_t> indices = {0u, 1u, 2u};
2460-
std::vector<Point> texture_coordinates = {};
2461-
std::vector<Color> vertex_colors = {};
2462-
auto geometry = std::make_shared<VerticesGeometry>(
2463-
vertices, indices, texture_coordinates, vertex_colors,
2464-
Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangleStrip);
2465-
2466-
canvas.DrawVertices(geometry, BlendMode::kSourceOver, paint);
2467-
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
2468-
}
2469-
2470-
// Regression test for https://github.com/flutter/flutter/issues/135441 .
2471-
TEST_P(AiksTest, VerticesGeometryUVPositionDataWithTranslate) {
2472-
Canvas canvas;
2473-
Paint paint;
2474-
auto texture = CreateTextureForFixture("table_mountain_nx.png");
2475-
2476-
paint.color_source = ColorSource::MakeImage(
2477-
texture, Entity::TileMode::kClamp, Entity::TileMode::kClamp, {},
2478-
Matrix::MakeTranslation({100.0, 100.0}));
2479-
2480-
auto vertices = {Point(0, 0), Point(texture->GetSize().width, 0),
2481-
Point(0, texture->GetSize().height)};
2482-
std::vector<uint16_t> indices = {0u, 1u, 2u};
2483-
std::vector<Point> texture_coordinates = {};
2484-
std::vector<Color> vertex_colors = {};
2485-
auto geometry = std::make_shared<VerticesGeometry>(
2486-
vertices, indices, texture_coordinates, vertex_colors,
2487-
Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangleStrip);
2488-
2489-
canvas.DrawVertices(geometry, BlendMode::kSourceOver, paint);
2490-
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
2491-
}
2492-
2493-
// Regression test for https://github.com/flutter/flutter/issues/145707
2494-
TEST_P(AiksTest, VerticesGeometryColorUVPositionData) {
2495-
Canvas canvas;
2496-
Paint paint;
2497-
auto texture = CreateTextureForFixture("table_mountain_nx.png");
2498-
2499-
paint.color_source =
2500-
ColorSource::MakeImage(texture, Entity::TileMode::kClamp,
2501-
Entity::TileMode::kClamp, {}, Matrix());
2502-
2503-
auto vertices = {
2504-
Point(0, 0),
2505-
Point(texture->GetSize().width, 0),
2506-
Point(0, texture->GetSize().height),
2507-
Point(texture->GetSize().width, 0),
2508-
Point(0, 0),
2509-
Point(texture->GetSize().width, texture->GetSize().height),
2510-
};
2511-
std::vector<uint16_t> indices = {};
2512-
std::vector<Point> texture_coordinates = {};
2513-
std::vector<Color> vertex_colors = {
2514-
Color::Red().WithAlpha(0.5), Color::Blue().WithAlpha(0.5),
2515-
Color::Green().WithAlpha(0.5), Color::Red().WithAlpha(0.5),
2516-
Color::Blue().WithAlpha(0.5), Color::Green().WithAlpha(0.5),
2517-
};
2518-
auto geometry = std::make_shared<VerticesGeometry>(
2519-
vertices, indices, texture_coordinates, vertex_colors,
2520-
Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangles);
2521-
2522-
canvas.DrawVertices(geometry, BlendMode::kDestinationOver, paint);
2523-
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
2524-
}
2525-
2526-
TEST_P(AiksTest, VerticesGeometryColorUVPositionDataAdvancedBlend) {
2527-
Canvas canvas;
2528-
Paint paint;
2529-
auto texture = CreateTextureForFixture("table_mountain_nx.png");
2530-
2531-
paint.color_source =
2532-
ColorSource::MakeImage(texture, Entity::TileMode::kClamp,
2533-
Entity::TileMode::kClamp, {}, Matrix());
2534-
2535-
auto vertices = {
2536-
Point(0, 0),
2537-
Point(texture->GetSize().width, 0),
2538-
Point(0, texture->GetSize().height),
2539-
Point(texture->GetSize().width, 0),
2540-
Point(0, 0),
2541-
Point(texture->GetSize().width, texture->GetSize().height),
2542-
};
2543-
std::vector<uint16_t> indices = {};
2544-
std::vector<Point> texture_coordinates = {};
2545-
std::vector<Color> vertex_colors = {
2546-
Color::Red().WithAlpha(0.5), Color::Blue().WithAlpha(0.5),
2547-
Color::Green().WithAlpha(0.5), Color::Red().WithAlpha(0.5),
2548-
Color::Blue().WithAlpha(0.5), Color::Green().WithAlpha(0.5),
2549-
};
2550-
auto geometry = std::make_shared<VerticesGeometry>(
2551-
vertices, indices, texture_coordinates, vertex_colors,
2552-
Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangles);
2553-
2554-
canvas.DrawVertices(geometry, BlendMode::kColorBurn, paint);
2555-
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
2556-
}
2557-
25582448
TEST_P(AiksTest, MatrixImageFilterMagnify) {
25592449
Scalar scale = 2.0;
25602450
auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {

impeller/display_list/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ template("display_list_unittests_component") {
5757
"aiks_dl_gradient_unittests.cc",
5858
"aiks_dl_opacity_unittests.cc",
5959
"aiks_dl_path_unittests.cc",
60+
"aiks_dl_vertices_unittests.cc",
6061
"dl_golden_blur_unittests.cc",
6162
"dl_golden_unittests.cc",
6263
"dl_playground.cc",

0 commit comments

Comments
 (0)