Skip to content

Commit 8cbd2bf

Browse files
[CP] [Impeller] Fix the issue that 'coverage_coords' is incorrectly calculated in 'FillPathGeometry::GetPositionUVBuffer' flutter#42155 (flutter#42180)
cp of flutter#42155
1 parent 7cafd6e commit 8cbd2bf

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ void CanRenderTiledTexture(AiksTest* aiks_test, Entity::TileMode tile_mode) {
177177
canvas.DrawRect({0, 0, 600, 600}, paint);
178178
}
179179

180+
// Should not change the image.
181+
PathBuilder path_builder;
182+
path_builder.AddCircle({150, 150}, 150);
183+
path_builder.AddRoundedRect(Rect::MakeLTRB(300, 300, 600, 600), 10);
184+
paint.style = Paint::Style::kFill;
185+
canvas.DrawPath(path_builder.TakePath(), paint);
186+
180187
ASSERT_TRUE(aiks_test->OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
181188
}
182189
} // namespace

impeller/entity/geometry.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ GeometryResult FillPathGeometry::GetPositionUVBuffer(
152152
Point vtx = {vertices[i], vertices[i + 1]};
153153
data.position = vtx;
154154
auto coverage_coords =
155-
((vtx - texture_coverage.origin) / texture_coverage.size) /
156-
texture_coverage.size;
155+
(vtx - texture_coverage.origin) / texture_coverage.size;
157156
data.texture_coords = effect_transform * coverage_coords;
158157
vertex_builder.AppendVertex(data);
159158
}

0 commit comments

Comments
 (0)