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

Commit c988047

Browse files
zandersobdero
andauthored
[CP] [Impeller] Account for the transform in DLVerticesGeometry coverage (#38998) (#39014)
Co-authored-by: Brandon DeRosier <[email protected]>
1 parent 45c5586 commit c988047

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
@@ -1055,9 +1055,11 @@ TEST_P(DisplayListTest, MaskBlursApplyCorrectlyToColorSources) {
10551055
}
10561056

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

10721074
paint.setColor(flutter::DlColor::kRed().modulateOpacity(0.5));
1075+
builder.scale(-1, -1);
10731076
builder.drawVertices(vertices, flutter::DlBlendMode::kSrcOver, paint);
10741077

10751078
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)