Skip to content

Commit

Permalink
[Impeller] Fix the issue that 'coverage_coords' is incorrectly calcul…
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdPaleLight authored May 19, 2023
1 parent aac0919 commit 45a72f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 7 additions & 0 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ void CanRenderTiledTexture(AiksTest* aiks_test, Entity::TileMode tile_mode) {
canvas.DrawRect({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);

ASSERT_TRUE(aiks_test->OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
} // namespace
Expand Down
6 changes: 2 additions & 4 deletions impeller/entity/geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
VS::PerVertexData data;
data.position = points[i];
auto coverage_coords =
((points[i] - texture_coverage.origin) / texture_coverage.size) /
texture_coverage.size;
(points[i] - texture_coverage.origin) / texture_coverage.size;
data.texture_coords = effect_transform * coverage_coords;
vertex_builder.AppendVertex(data);
}
Expand Down Expand Up @@ -238,8 +237,7 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
Point vtx = {vertices[i], vertices[i + 1]};
data.position = vtx;
auto coverage_coords =
((vtx - texture_coverage.origin) / texture_coverage.size) /
texture_coverage.size;
(vtx - texture_coverage.origin) / texture_coverage.size;
data.texture_coords = effect_transform * coverage_coords;
vertex_builder.AppendVertex(data);
}
Expand Down

0 comments on commit 45a72f0

Please sign in to comment.