Skip to content
/ imgui Public
forked from ocornut/imgui

Commit

Permalink
ImDrawData: Fixed an issue where TotalVtxCount/TotalIdxCount does not…
Browse files Browse the repository at this point in the history
… match the sum of individual ImDrawList's buffer sizes. (ocornut#6716)

Amend dbeeeae
  • Loading branch information
ocornut committed Aug 14, 2023
1 parent 63b6300 commit f422e78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Other changes:
through proper navigation logic: honor scrolling and selection. (#1079, #1131)
- Sliders: Fixed an integer overflow and div-by-zero in SliderInt() when
v_max=INT_MAX (#6675, #6679) [@jbarthelmes]
- ImDrawData: Fixed an issue where TotalVtxCount/TotalIdxCount does not match the sum
of individual ImDrawList's buffer sizes when a dimming/modal background is rendered. (#6716)
- ImDrawList: Fixed OOB access in _CalcCircleAutoSegmentCount when passing excessively
large radius to AddCircle(). (#6657, #5317) [@EggsyCRO, @jdpatdiscord]
- Debug Tools: Metrics: Fixed "Drawlists" section and per-viewport equivalent
Expand Down
17 changes: 11 additions & 6 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5011,8 +5011,6 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer)
ImGuiViewportP* viewport = window->Viewport;
IM_ASSERT(viewport != NULL);
g.IO.MetricsRenderWindows++;
if (window->Flags & ImGuiWindowFlags_DockNodeHost)
window->DrawList->ChannelsMerge();
ImGui::AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[layer], window->DrawList);
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
{
Expand Down Expand Up @@ -5349,6 +5347,17 @@ void ImGui::Render()
AddDrawListToDrawDataEx(&viewport->DrawDataP, viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
}

for (int n = 0; n != g.WindowsFocusOrder.Size; n++)
{
ImGuiWindow* window = g.Windows[n];
if (window->Flags & ImGuiWindowFlags_DockNodeHost)
window->DrawList->ChannelsMerge();
}

// Draw modal/window whitening backgrounds
if (first_render_of_frame)
RenderDimmedBackgrounds();

// Add ImDrawList to render
ImGuiWindow* windows_to_render_top_most[2];
windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindowDockTree : NULL;
Expand All @@ -5364,10 +5373,6 @@ void ImGui::Render()
if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window
AddRootWindowToDrawData(windows_to_render_top_most[n]);

// Draw modal/window whitening backgrounds
if (first_render_of_frame)
RenderDimmedBackgrounds();

// Draw software mouse cursor if requested by io.MouseDrawCursor flag
if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None)
RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
Expand Down

0 comments on commit f422e78

Please sign in to comment.