| 4153 | } |
| 4154 | |
| 4155 | void ImGui::Render() |
| 4156 | { |
| 4157 | ImGuiContext& g = *GImGui; |
| 4158 | IM_ASSERT(g.Initialized); |
| 4159 | |
| 4160 | if (g.FrameCountEnded != g.FrameCount) |
| 4161 | EndFrame(); |
| 4162 | g.FrameCountRendered = g.FrameCount; |
| 4163 | g.IO.MetricsRenderWindows = 0; |
| 4164 | g.DrawDataBuilder.Clear(); |
| 4165 | |
| 4166 | // Add background ImDrawList |
| 4167 | if (!g.BackgroundDrawList.VtxBuffer.empty()) |
| 4168 | AddDrawListToDrawData(&g.DrawDataBuilder.Layers[0], &g.BackgroundDrawList); |
| 4169 | |
| 4170 | // Add ImDrawList to render |
| 4171 | ImGuiWindow* windows_to_render_top_most[2]; |
| 4172 | windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL; |
| 4173 | windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingList : NULL); |
| 4174 | for (int n = 0; n != g.Windows.Size; n++) |
| 4175 | { |
| 4176 | ImGuiWindow* window = g.Windows[n]; |
| 4177 | if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1]) |
| 4178 | AddRootWindowToDrawData(window); |
| 4179 | } |
| 4180 | for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_top_most); n++) |
| 4181 | if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window |
| 4182 | AddRootWindowToDrawData(windows_to_render_top_most[n]); |
| 4183 | g.DrawDataBuilder.FlattenIntoSingleLayer(); |
| 4184 | |
| 4185 | // Draw software mouse cursor if requested |
| 4186 | if (g.IO.MouseDrawCursor) |
| 4187 | RenderMouseCursor(&g.ForegroundDrawList, g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)); |
| 4188 | |
| 4189 | // Add foreground ImDrawList |
| 4190 | if (!g.ForegroundDrawList.VtxBuffer.empty()) |
| 4191 | AddDrawListToDrawData(&g.DrawDataBuilder.Layers[0], &g.ForegroundDrawList); |
| 4192 | |
| 4193 | // Setup ImDrawData structure for end-user |
| 4194 | SetupDrawData(&g.DrawDataBuilder.Layers[0], &g.DrawData); |
| 4195 | g.IO.MetricsRenderVertices = g.DrawData.TotalVtxCount; |
| 4196 | g.IO.MetricsRenderIndices = g.DrawData.TotalIdxCount; |
| 4197 | |
| 4198 | // (Legacy) Call the Render callback function. The current prefer way is to let the user retrieve GetDrawData() and call the render function themselves. |
| 4199 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 4200 | if (g.DrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL) |
| 4201 | g.IO.RenderDrawListsFn(&g.DrawData); |
| 4202 | #endif |
| 4203 | } |
| 4204 | |
| 4205 | // Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker. |
| 4206 | // CalcTextSize("") should return ImVec2(0.0f, g.FontSize) |
nothing calls this directly
no test coverage detected