From 4694b509240fe2a1e1901eb0c21ea20a6a358cd1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 28 Jul 2026 16:35:56 +0200 Subject: [PATCH] DrawList: moved _GetStrokePos() to a local inline function. --- imgui.h | 1 - imgui_draw.cpp | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/imgui.h b/imgui.h index d80ef0d54..3e2c6cd8e 100644 --- a/imgui.h +++ b/imgui.h @@ -3663,7 +3663,6 @@ struct ImDrawList IMGUI_API void _OnChangedTexture(); IMGUI_API void _OnChangedVtxOffset(); IMGUI_API void _SetTexture(ImTextureRef tex_ref); - IMGUI_API ImDrawFlags _GetStrokePos(ImDrawFlags flags, ImDrawFlags default_stroke_pos); IMGUI_API int _CalcCircleAutoSegmentCount(float radius) const; IMGUI_API void _PathArcToFastEx(const ImVec2& center, float radius, int a_min_sample, int a_max_sample, int a_step); IMGUI_API void _PathArcToN(const ImVec2& center, float radius, float a_min, float a_max, int num_segments); diff --git a/imgui_draw.cpp b/imgui_draw.cpp index e1e3ed8fd..5cdeb996b 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -931,6 +931,16 @@ void ImDrawList::_SelectFringeTexture(float screen_thickness, ImVec4* out_tex_uv // Scale the fringe so that the texture matches the line thickness. *out_fringe = _FringeScale * screen_thickness * tex_uvs.w; // tex_uvs.w = 1 / thickness } + +// We intently don't turn g_LEGACY_STROKES into ImDrawFlags_StrokeLegacy here. +// The earlier should use verbatim legacy code but will be removed before release once we confirm that both matches. +static inline ImDrawFlags _GetStrokePos(ImDrawFlags flags, ImDrawFlags default_stroke_pos) +{ + if (flags & ImDrawFlags_StrokeMask_) + return (flags & ImDrawFlags_StrokeMask_); + return default_stroke_pos; +} + IM_MSVC_RUNTIME_CHECKS_RESTORE extern bool g_LEGACY_STROKES; @@ -2195,17 +2205,6 @@ void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDr } } -// We intently don't turn g_LEGACY_STROKES into ImDrawFlags_StrokeLegacy here. -// The earlier should use verbatim legacy code but will be removed before release once we confirm that both matches. -IM_MSVC_RUNTIME_CHECKS_OFF -ImDrawFlags ImDrawList::_GetStrokePos(ImDrawFlags flags, ImDrawFlags default_stroke_pos) -{ - if (flags & ImDrawFlags_StrokeMask_) - return (flags & ImDrawFlags_StrokeMask_); - return default_stroke_pos; -} -IM_MSVC_RUNTIME_CHECKS_RESTORE - void ImDrawList::_AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness, ImDrawFlags flags) { if (g_LEGACY_STROKES) IM_UNLIKELY