1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibGfx: Avoid invalidation when Path::close() is a no-op

If the path is already closed, calling close() is a no-op, and we don't
need to invalidate the split lines cache.
This commit is contained in:
Andreas Kling 2021-09-17 13:41:34 +02:00
parent 32b9d80ee5
commit c8c3828b59

View file

@ -118,8 +118,6 @@ void Path::close()
if (m_segments.size() <= 1)
return;
invalidate_split_lines();
auto& last_point = m_segments.last().point();
for (ssize_t i = m_segments.size() - 1; i >= 0; --i) {
@ -128,6 +126,7 @@ void Path::close()
if (last_point == segment.point())
return;
append_segment<LineSegment>(segment.point());
invalidate_split_lines();
return;
}
}