[Impeller] Apply the transform to PointFieldGeometry coverage (flutter/engine#46428)
Fixes https://github.com/flutter/flutter/issues/134068
This commit is contained in:
@@ -2417,6 +2417,14 @@ TEST_P(EntityTest, PointFieldGeometryDivisions) {
|
||||
ASSERT_EQ(PointFieldGeometry::ComputeCircleDivisions(20000.0, true), 140u);
|
||||
}
|
||||
|
||||
TEST_P(EntityTest, PointFieldGeometryCoverage) {
|
||||
std::vector<Point> points = {{10, 20}, {100, 200}};
|
||||
auto geometry = Geometry::MakePointField(points, 5.0, false);
|
||||
ASSERT_EQ(*geometry->GetCoverage(Matrix()), Rect::MakeLTRB(5, 15, 105, 205));
|
||||
ASSERT_EQ(*geometry->GetCoverage(Matrix::MakeTranslation({30, 0, 0})),
|
||||
Rect::MakeLTRB(35, 15, 135, 205));
|
||||
}
|
||||
|
||||
TEST_P(EntityTest, ColorFilterContentsWithLargeGeometry) {
|
||||
Entity entity;
|
||||
entity.SetTransformation(Matrix::MakeScale(GetContentScale()));
|
||||
|
||||
@@ -287,8 +287,9 @@ std::optional<Rect> PointFieldGeometry::GetCoverage(
|
||||
right = std::max(right, it->x);
|
||||
bottom = std::max(bottom, it->y);
|
||||
}
|
||||
return Rect::MakeLTRB(left - radius_, top - radius_, right + radius_,
|
||||
bottom + radius_);
|
||||
auto coverage = Rect::MakeLTRB(left - radius_, top - radius_,
|
||||
right + radius_, bottom + radius_);
|
||||
return coverage.TransformBounds(transform);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user