From 75ac1ab2c36c988f86067434fd3f178fe0fb4097 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 6 Oct 2026 20:36:23 +0200 Subject: [PATCH] DrawList: AddCircle: fixed issue not clearing path in unlikely case where Path.Size<3. --- imgui_draw.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index db3d003d9..4cf094c57 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2735,14 +2735,14 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu PathArcTo(center, radius, 0.0f, a_max, num_segments - 1); } - if (_Path.Size < 3) - return; - - // Calculate distance to the edge of the polygon describing the circle. - // This will be used by _AddPolyline() to clamp the inner stroke expansion, to avoid creating rendering artifacts. - const float unit_apothem = ApproxApothem(_Path.Size); - const float edge_dist = radius * unit_apothem; - _AddPolyline(_Path.Data, _Path.Size, col, thickness, ImDrawFlags_Closed | ImDrawFlags_JoinMiter | stroke_pos, edge_dist); + if (_Path.Size >= 3) + { + // Calculate distance to the edge of the polygon describing the circle. + // This will be used by _AddPolyline() to clamp the inner stroke expansion, to avoid creating rendering artifacts. + const float unit_apothem = ApproxApothem(_Path.Size); + const float edge_dist = radius * unit_apothem; + _AddPolyline(_Path.Data, _Path.Size, col, thickness, ImDrawFlags_Closed | ImDrawFlags_JoinMiter | stroke_pos, edge_dist); + } _Path.Size = 0; }