From 25fbff2156640cc79e9a79db00522019b4a0420f Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 19 Apr 2021 14:58:42 +0200 Subject: [PATCH] ImDrawList: Revert alteration of normal scaling threshold, for now prioritize preserving property of limiting extents. (#4053, #3366, #2964, #2868, #2518, #2183) Amend fdda8b8 --- docs/CHANGELOG.txt | 3 +-- imgui_draw.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0bd685abb..acd86b9dc 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -57,8 +57,7 @@ Other Changes: - Popups: Added 'OpenPopup(ImGuiID id)' overload to facilitate calling from nested stacks. (#3993, #331) [@zlash] - ImDrawList: Fixed/improved thickness of thick strokes with sharp angles. (#4053, #3366, #2964, #2868, #2518, #2183) Effectively introduced a regression in 1.67 (Jan 2019), and a fix in 1.70 (Apr 2019) but the fix wasn't actually on - par with original version. Now incorporating the correct fix + tweaked threshold to further mitigate the effect of - varying thickness, up to a certain degree. Shapes with very sharp angles and thick strokes will extend a little more. + par with original version. Now incorporating the correct revert. - ImDrawList: Fixed PathArcTo() regression from 1.82 preventing use of counter-clockwise angles. (#4030, #3491) [@thedmd] - Demo: Improved popups demo and comments. - Backends: SDL: Rework global mouse pos availability check listing supported platforms explicitly, diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 2604ac1aa..8f851d263 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -689,7 +689,7 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c // On AddPolyline() and AddConvexPolyFilled() we intentionally avoid using ImVec2 and superfluous function calls to optimize debug/non-inlined builds. // Those macros expects l-values. #define IM_NORMALIZE2F_OVER_ZERO(VX,VY) do { float d2 = VX*VX + VY*VY; if (d2 > 0.0f) { float inv_len = 1.0f / ImSqrt(d2); VX *= inv_len; VY *= inv_len; } } while (0) -#define IM_FIXNORMAL2F_MAX_INVLEN2 500.0f +#define IM_FIXNORMAL2F_MAX_INVLEN2 100.0f // 500.0f (see #4053, #3366) #define IM_FIXNORMAL2F(VX,VY) do { float d2 = VX*VX + VY*VY; if (d2 > 0.000001f) { float inv_len2 = 1.0f / d2; if (inv_len2 > IM_FIXNORMAL2F_MAX_INVLEN2) inv_len2 = IM_FIXNORMAL2F_MAX_INVLEN2; VX *= inv_len2; VY *= inv_len2; } } while (0) // TODO: Thickness anti-aliased lines cap are missing their AA fringe.