From c8c3828b59fe09dd1380285506f17271bac0cb82 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 Sep 2021 13:41:34 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibGfx/Path.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Path.cpp b/Userland/Libraries/LibGfx/Path.cpp index fcbb38510c..248fc5dced 100644 --- a/Userland/Libraries/LibGfx/Path.cpp +++ b/Userland/Libraries/LibGfx/Path.cpp @@ -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(segment.point()); + invalidate_split_lines(); return; } }