| 9967 | } |
| 9968 | |
| 9969 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 9970 | { |
| 9971 | if (!ImGui::Begin("Dear ImGui Metrics", p_open)) |
| 9972 | { |
| 9973 | ImGui::End(); |
| 9974 | return; |
| 9975 | } |
| 9976 | |
| 9977 | // Debugging enums |
| 9978 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 9979 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentRegionRect" }; |
| 9980 | enum { TRT_OuterRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersDesired, TRT_ColumnsContentRowsFrozen, TRT_ColumnsContentRowsUnfrozen, TRT_Count }; // Tables Rect Type |
| 9981 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersDesired", "ColumnsContentRowsFrozen", "ColumnsContentRowsUnfrozen" }; |
| 9982 | |
| 9983 | // State |
| 9984 | static bool show_windows_rects = false; |
| 9985 | static int show_windows_rect_type = WRT_WorkRect; |
| 9986 | static bool show_windows_begin_order = false; |
| 9987 | static bool show_tables_rects = false; |
| 9988 | static int show_tables_rect_type = TRT_WorkRect; |
| 9989 | static bool show_drawcmd_details = true; |
| 9990 | |
| 9991 | // Basic info |
| 9992 | ImGuiContext& g = *GImGui; |
| 9993 | ImGuiIO& io = ImGui::GetIO(); |
| 9994 | ImGui::Text("Dear ImGui %s", ImGui::GetVersion()); |
| 9995 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 9996 | ImGui::Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 9997 | ImGui::Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows); |
| 9998 | ImGui::Text("%d active allocations", io.MetricsActiveAllocations); |
| 9999 | ImGui::Separator(); |
| 10000 | |
| 10001 | // Helper functions to display common structures: |
| 10002 | // - NodeDrawList() |
| 10003 | // - NodeColumns() |
| 10004 | // - NodeWindow() |
| 10005 | // - NodeWindows() |
| 10006 | // - NodeTabBar() |
| 10007 | // - NodeStorage() |
| 10008 | struct Funcs |
| 10009 | { |
| 10010 | static ImRect GetWindowRect(ImGuiWindow* window, int rect_type) |
| 10011 | { |
| 10012 | if (rect_type == WRT_OuterRect) { return window->Rect(); } |
| 10013 | else if (rect_type == WRT_OuterRectClipped) { return window->OuterRectClipped; } |
| 10014 | else if (rect_type == WRT_InnerRect) { return window->InnerRect; } |
| 10015 | else if (rect_type == WRT_InnerClipRect) { return window->InnerClipRect; } |
| 10016 | else if (rect_type == WRT_WorkRect) { return window->WorkRect; } |
| 10017 | else if (rect_type == WRT_Content) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); } |
| 10018 | else if (rect_type == WRT_ContentRegionRect) { return window->ContentRegionRect; } |
| 10019 | IM_ASSERT(0); |
| 10020 | return ImRect(); |
| 10021 | } |
| 10022 | |
| 10023 | static void NodeDrawList(ImGuiWindow* window, ImDrawList* draw_list, const char* label) |
| 10024 | { |
| 10025 | bool node_open = ImGui::TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size); |
| 10026 | if (draw_list == ImGui::GetWindowDrawList()) |
nothing calls this directly
no test coverage detected