[Impeller] fix rect geometry coverage (flutter/engine#37005)
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user