[Impeller] Account for the transform in DLVerticesGeometry coverage (flutter/engine#38998)

This commit is contained in:
Brandon DeRosier
2023-01-19 13:06:50 -08:00
committed by GitHub
parent f5f21291ab
commit 81bc7866c9
2 changed files with 7 additions and 4 deletions

View File

@@ -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()};
@@ -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()));

View File

@@ -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