From d71091a95761e71262162150a3c164848d65c7a2 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 4 Dec 2025 16:27:54 +0100 Subject: [PATCH] Internals: amend RenderRectFilledRangeH() to avoid shadowed variables. --- imgui_draw.cpp | 8 ++++---- imgui_internal.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 64e88fb55..bee1503de 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -5915,13 +5915,13 @@ static inline float ImAcos01(float x) // FIXME: Cleanup and move code to ImDrawList. // - Before 2025-12-04: RenderRectFilledRangeH() with 'float x_start_norm, float x_end_norm` <- normalized // - After 2025-12-04: RenderRectFilledInRangeH() with 'float x1, float x2' <- absolute coords!! -void ImGui::RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x1, float x2, float rounding) +void ImGui::RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding) { - if (x1 == x2) + if (fill_x0 > fill_x1) return; - ImVec2 p0 = ImVec2(x1, rect.Min.y); - ImVec2 p1 = ImVec2(x2, rect.Max.y); + ImVec2 p0 = ImVec2(fill_x0, rect.Min.y); + ImVec2 p1 = ImVec2(fill_x1, rect.Max.y); if (rounding == 0.0f) { draw_list->AddRectFilled(p0, p1, col, 0.0f); diff --git a/imgui_internal.h b/imgui_internal.h index 2da881038..c1fcfbaf4 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -3587,7 +3587,7 @@ namespace ImGui IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col); IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz); IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col); - IMGUI_API void RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x1, float x2, float rounding); + IMGUI_API void RenderRectFilledInRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float fill_x0, float fill_x1, float rounding); IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding); // Widgets: Text