From 89685b346c7b02b7d557678fd9d5d11a80967f83 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 9 Jul 2020 11:21:31 +0200 Subject: [PATCH] ImDrawList: Fixed minor bug introduced in 1.75 where AddCircle() with 12 segments would generate an extra unrequired vertex. Actual missing code for d3b37180a3ff186b481d93d09664bb244a428d10, thanks @domgho! --- docs/CHANGELOG.txt | 8 ++++---- imgui_draw.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 8043bf47..8f4de8d9 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -37,12 +37,14 @@ HOW TO UPDATE? Other Changes: -- ImDrawList: Thick anti-aliased strokes (> 1.0f) with integer thickness now use a texture-based +- ImDrawList: Thick anti-aliased strokes (> 1.0f) with integer thickness now use a texture-based path, reducing the amount of vertices/indices and CPU/GPU usage. (#3245) [@Shironekoben] - - This change will facilitate the wider use of thick borders in future style changes. + - This change will facilitate the wider use of thick borders in future style changes. - Requires an extra bit of texture space (~64x64 by default), relies on GPU bilinear filtering. - Clear io.AntiAliasedLinesUseTex = false; to disable rendering using this method. - Clear ImFontAtlasFlags_NoBakedLines in ImFontAtlas::Flags to disable baking data in texture. +- ImDrawList: Fixed minor bug introduced in 1.75 where AddCircle() with 12 segments would generate + an extra vertex. (This bug was mistakenly marked as fixed in earlier 1.77 release). [@ShironekoBen] ----------------------------------------------------------------------- @@ -112,8 +114,6 @@ Other Changes: VtxOffset was not zero would lead to draw commands with wrong VtxOffset. (#2591) - ImDrawList, ImDrawListSplitter, Columns: Fixed an issue where starting a split right after a callback draw command would incorrectly override the callback draw command. -- ImDrawList: Fixed minor bug introduced in 1.75 where AddCircle() with 12 segments would - generate an extra unrequired vertex. [@ShironekoBen] - Misc, Freetype: Fix for rare case where FT_Get_Char_Index() succeeds but FT_Load_Glyph() fails. - Docs: Improved and moved font documentation to docs/FONTS.md so it can be readable on the web. Updated various links/wiki accordingly. Added FAQ entry about DPI. (#2861) [@ButternCream, @ocornut] diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 942c2d90..cdaa34fa 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1235,7 +1235,7 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu // Because we are filling a closed shape we remove 1 from the count of segments/points const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; if (num_segments == 12) - PathArcToFast(center, radius - 0.5f, 0, 12); + PathArcToFast(center, radius - 0.5f, 0, 12 - 1); else PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1); PathStroke(col, true, thickness); @@ -1265,7 +1265,7 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, // Because we are filling a closed shape we remove 1 from the count of segments/points const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments; if (num_segments == 12) - PathArcToFast(center, radius, 0, 12); + PathArcToFast(center, radius, 0, 12 - 1); else PathArcTo(center, radius, 0.0f, a_max, num_segments - 1); PathFillConvex(col);