Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update playground tests to include all modified cases and fix matrix …
…ordering
  • Loading branch information
flar committed Nov 8, 2023
commit 4e1604fdb6339bed67f7908ba5fc5f04bbff010a
46 changes: 40 additions & 6 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,23 @@ void CanRenderTiledTexture(AiksTest* aiks_test,
canvas.DrawRect(Rect::MakeXYWH(0, 0, 600, 600), paint);
}

// Should not change the image.
PathBuilder path_builder;
path_builder.AddCircle({150, 150}, 150);
path_builder.AddRoundedRect(Rect::MakeLTRB(300, 300, 600, 600), 10);
paint.style = Paint::Style::kFill;
canvas.DrawPath(path_builder.TakePath(), paint);
{
// Should not change the image.
PathBuilder path_builder;
path_builder.AddCircle({150, 150}, 150);
path_builder.AddRoundedRect(Rect::MakeLTRB(300, 300, 600, 600), 10);
paint.style = Paint::Style::kFill;
canvas.DrawPath(path_builder.TakePath(), paint);
}

{
// Should not change the image. Tests the Convex short-cut code.
PathBuilder path_builder;
path_builder.AddCircle({150, 450}, 150);
path_builder.SetConvexity(Convexity::kConvex);
paint.style = Paint::Style::kFill;
canvas.DrawPath(path_builder.TakePath(), paint);
}

ASSERT_TRUE(aiks_test->OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
Expand Down Expand Up @@ -3744,6 +3755,29 @@ TEST_P(AiksTest, VerticesGeometryUVPositionData) {
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

// Regression test for https://github.com/flutter/flutter/issues/135441 .
TEST_P(AiksTest, VerticesGeometryUVPositionDataWithTranslate) {
Canvas canvas;
Paint paint;
auto texture = CreateTextureForFixture("table_mountain_nx.png");

paint.color_source = ColorSource::MakeImage(
texture, Entity::TileMode::kClamp, Entity::TileMode::kClamp, {},
Matrix::MakeTranslation({100.0, 100.0}));

auto vertices = {Point(0, 0), Point(texture->GetSize().width, 0),
Point(0, texture->GetSize().height)};
std::vector<uint16_t> indices = {0u, 1u, 2u};
std::vector<Point> texture_coordinates = {};
std::vector<Color> vertex_colors = {};
auto geometry = std::make_shared<VerticesGeometry>(
vertices, indices, texture_coordinates, vertex_colors,
Rect::MakeLTRB(0, 0, 1, 1), VerticesGeometry::VertexMode::kTriangleStrip);

canvas.DrawVertices(geometry, BlendMode::kSourceOver, paint);
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

TEST_P(AiksTest, ClearBlendWithBlur) {
Canvas canvas;
Paint white;
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/geometry/fill_path_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
using VS = TextureFillVertexShader;

auto uv_transform =
effect_transform * texture_coverage.GetNormalizingTransform();
texture_coverage.GetNormalizingTransform() * effect_transform;

if (path_.GetFillType() == FillType::kNonZero && //
path_.IsConvex()) {
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/geometry/geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ GeometryResult ComputeUVGeometryForRect(Rect source_rect,
auto& host_buffer = pass.GetTransientsBuffer();

auto uv_transform =
effect_transform * texture_coverage.GetNormalizingTransform();
texture_coverage.GetNormalizingTransform() * effect_transform;
std::vector<Point> data(8);
auto points = source_rect.GetPoints();
for (auto i = 0u, j = 0u; i < 8; i += 2, j++) {
Expand Down
2 changes: 1 addition & 1 deletion impeller/entity/geometry/vertices_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ GeometryResult VerticesGeometry::GetPositionUVBuffer(
auto index_count = indices_.size();
auto vertex_count = vertices_.size();
auto uv_transform =
effect_transform * texture_coverage.GetNormalizingTransform();
texture_coverage.GetNormalizingTransform() * effect_transform;
auto has_texture_coordinates = HasTextureCoordinates();
std::vector<VS::PerVertexData> vertex_data(vertex_count);
{
Expand Down