DrawList: moved _GetStrokePos() to a local inline function.

This commit is contained in:
ocornut
2026-07-28 16:35:56 +02:00
parent fb9fd9a250
commit 4694b50924
2 changed files with 10 additions and 12 deletions

View File

@@ -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