Skip to content

Commit

Permalink
[Impeller] Account for the transform in DLVerticesGeometry coverage (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero authored and zanderso committed Jan 19, 2023
1 parent d70f869 commit 3540ad1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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 @@ -1055,9 +1055,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 @@ -1070,6 +1072,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

0 comments on commit 3540ad1

Please sign in to comment.