[Impeller] fix rect geometry coverage (flutter/engine#37005)

This commit is contained in:
Jonah Williams
2022-10-25 11:17:08 -07:00
committed by GitHub
parent 7239e9a85b
commit 84d5562346
2 changed files with 9 additions and 1 deletions

View File

@@ -191,6 +191,14 @@ TEST_P(EntityTest, CanDrawRect) {
ASSERT_TRUE(OpenPlaygroundHere(entity));
}
TEST_P(EntityTest, GeometryBoundsAreTransformed) {
auto geometry = Geometry::MakeRect({100, 100, 100, 100});
auto transform = Matrix::MakeScale({2.0, 2.0, 2.0});
ASSERT_RECT_NEAR(geometry->GetCoverage(transform).value(),
Rect(200, 200, 200, 200));
}
TEST_P(EntityTest, ThreeStrokesInOnePath) {
Path path = PathBuilder{}
.MoveTo({100, 100})

View File

@@ -676,7 +676,7 @@ GeometryVertexType RectGeometry::GetVertexType() const {
}
std::optional<Rect> RectGeometry::GetCoverage(const Matrix& transform) const {
return rect_;
return rect_.TransformBounds(transform);
}
} // namespace impeller