Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,28 @@ TEST_P(AiksTest, CanDrawAnOpenPath) {
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

TEST_P(AiksTest, CanDrawAnOpenPathThatIsntARect) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one of the playground tests that also makes a golden?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC these are all playground tests, so we should see a golden delta pop up in a bit.

Canvas canvas;

// Draw a stroked path that is explicitly closed to verify
// It doesn't become a rectangle.
PathBuilder builder;
builder.MoveTo({50, 50});
builder.LineTo({520, 120});
builder.LineTo({300, 310});
builder.LineTo({100, 50});
builder.Close();

Paint paint;
paint.color = Color::Red();
paint.style = Paint::Style::kStroke;
paint.stroke_width = 10;

canvas.DrawPath(builder.TakePath(), paint);

ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

static sk_sp<SkData> OpenFixtureAsSkData(const char* fixture_name) {
auto mapping = flutter::testing::OpenFixtureAsMapping(fixture_name);
if (!mapping) {
Expand Down
2 changes: 1 addition & 1 deletion impeller/display_list/dl_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ void DlDispatcher::drawPath(const SkPath& path) {

// We can't "optimize" a path into a rectangle if it's open.
bool closed;
if (path.isRect(&rect, &closed); closed) {
if (path.isRect(&rect, &closed) && closed) {
canvas_.DrawRect(skia_conversions::ToRect(rect), paint_);
return;
}
Expand Down