| 13630 | } |
| 13631 | |
| 13632 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 13633 | { |
| 13634 | ImGuiContext& g = *GImGui; |
| 13635 | ImGuiIO& io = g.IO; |
| 13636 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 13637 | if (cfg->ShowDebugLog) |
| 13638 | ShowDebugLogWindow(&cfg->ShowDebugLog); |
| 13639 | if (cfg->ShowStackTool) |
| 13640 | ShowStackToolWindow(&cfg->ShowStackTool); |
| 13641 | |
| 13642 | if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 13643 | { |
| 13644 | End(); |
| 13645 | return; |
| 13646 | } |
| 13647 | |
| 13648 | // Basic info |
| 13649 | Text("Dear ImGui %s", GetVersion()); |
| 13650 | Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 13651 | Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 13652 | Text("%d visible windows, %d active allocations", io.MetricsRenderWindows, io.MetricsActiveAllocations); |
| 13653 | //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; } |
| 13654 | |
| 13655 | Separator(); |
| 13656 | |
| 13657 | // Debugging enums |
| 13658 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 13659 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" }; |
| 13660 | enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsWorkRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type |
| 13661 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" }; |
| 13662 | if (cfg->ShowWindowsRectsType < 0) |
| 13663 | cfg->ShowWindowsRectsType = WRT_WorkRect; |
| 13664 | if (cfg->ShowTablesRectsType < 0) |
| 13665 | cfg->ShowTablesRectsType = TRT_WorkRect; |
| 13666 | |
| 13667 | struct Funcs |
| 13668 | { |
| 13669 | static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) |
| 13670 | { |
| 13671 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance |
| 13672 | if (rect_type == TRT_OuterRect) { return table->OuterRect; } |
| 13673 | else if (rect_type == TRT_InnerRect) { return table->InnerRect; } |
| 13674 | else if (rect_type == TRT_WorkRect) { return table->WorkRect; } |
| 13675 | else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } |
| 13676 | else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } |
| 13677 | else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } |
| 13678 | else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table_instance->LastOuterHeight); } |
| 13679 | else if (rect_type == TRT_ColumnsWorkRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); } |
| 13680 | else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } |
| 13681 | else if (rect_type == TRT_ColumnsContentHeadersUsed) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } // Note: y1/y2 not always accurate |
| 13682 | else if (rect_type == TRT_ColumnsContentHeadersIdeal) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } |
| 13683 | else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight); } |
| 13684 | else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } |
| 13685 | IM_ASSERT(0); |
| 13686 | return ImRect(); |
| 13687 | } |
| 13688 | |
| 13689 | static ImRect GetWindowRect(ImGuiWindow* window, int rect_type) |
nothing calls this directly
no test coverage detected