From 93200a6c370cd1e9606718ee286901cb82d135dd Mon Sep 17 00:00:00 2001 From: Mikulas Florek Date: Sat, 19 Sep 2015 21:12:26 +0200 Subject: [PATCH] fixed rendering of histogram with a lot of values --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 96b0bd9c..8b3f900e 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6613,7 +6613,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge for (int n = 0; n < res_w; n++) { const float t1 = t0 + t_step; - const int v_idx = (int)(t0 * values_count); + const int v_idx = (int)(t0 * values_count + 0.5f); IM_ASSERT(v_idx >= 0 && v_idx < values_count); const float v1 = values_getter(data, (v_idx + values_offset + 1) % values_count); const ImVec2 p1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) );