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

[Impeller] Account for the transform in DLVerticesGeometry coverage #38998

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions impeller/display_list/display_list_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,11 @@ TEST_P(DisplayListTest, MaskBlursApplyCorrectlyToColorSources) {
}

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

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

ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
Expand Down
2 changes: 1 addition & 1 deletion impeller/display_list/display_list_vertices_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ GeometryVertexType DLVerticesGeometry::GetVertexType() const {

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

} // namespace impeller