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

Commit dd8c259

Browse files
authored
[Impeller] Account for the transform in DLVerticesGeometry coverage (#38998)
1 parent f2536ce commit dd8c259

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

impeller/display_list/display_list_unittests.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,9 +1056,11 @@ TEST_P(DisplayListTest, MaskBlursApplyCorrectlyToColorSources) {
10561056
}
10571057

10581058
TEST_P(DisplayListTest, DrawVerticesSolidColorTrianglesWithoutIndices) {
1059-
std::vector<SkPoint> positions = {SkPoint::Make(100, 300),
1060-
SkPoint::Make(200, 100),
1061-
SkPoint::Make(300, 300)};
1059+
// Use negative coordinates and then scale the transform by -1, -1 to make
1060+
// sure coverage is taking the transform into account.
1061+
std::vector<SkPoint> positions = {SkPoint::Make(-100, -300),
1062+
SkPoint::Make(-200, -100),
1063+
SkPoint::Make(-300, -300)};
10621064
std::vector<flutter::DlColor> colors = {flutter::DlColor::kWhite(),
10631065
flutter::DlColor::kGreen(),
10641066
flutter::DlColor::kWhite()};
@@ -1071,6 +1073,7 @@ TEST_P(DisplayListTest, DrawVerticesSolidColorTrianglesWithoutIndices) {
10711073
flutter::DlPaint paint;
10721074

10731075
paint.setColor(flutter::DlColor::kRed().modulateOpacity(0.5));
1076+
builder.scale(-1, -1);
10741077
builder.drawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
10751078

10761079
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));

impeller/display_list/display_list_vertices_geometry.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ GeometryVertexType DLVerticesGeometry::GetVertexType() const {
241241

242242
std::optional<Rect> DLVerticesGeometry::GetCoverage(
243243
const Matrix& transform) const {
244-
return ToRect(vertices_->bounds());
244+
return ToRect(vertices_->bounds()).TransformBounds(transform);
245245
}
246246

247247
} // namespace impeller

0 commit comments

Comments
 (0)