| 18594 | } |
| 18595 | |
| 18596 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 18597 | { |
| 18598 | ImGuiContext& g = *GImGui; |
| 18599 | ImGuiIO& io = g.IO; |
| 18600 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 18601 | if (cfg->ShowDebugLog) |
| 18602 | ShowDebugLogWindow(&cfg->ShowDebugLog); |
| 18603 | if (cfg->ShowStackTool) |
| 18604 | ShowStackToolWindow(&cfg->ShowStackTool); |
| 18605 | |
| 18606 | if (!Begin("Dear ImGui Metrics/Debugger", p_open) || GetCurrentWindow()->BeginCount > 1) |
| 18607 | { |
| 18608 | End(); |
| 18609 | return; |
| 18610 | } |
| 18611 | |
| 18612 | // Basic info |
| 18613 | Text("Dear ImGui %s", GetVersion()); |
| 18614 | Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
| 18615 | Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); |
| 18616 | Text("%d visible windows, %d active allocations", io.MetricsRenderWindows, io.MetricsActiveAllocations); |
| 18617 | //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; } |
| 18618 | |
| 18619 | Separator(); |
| 18620 | |
| 18621 | // Debugging enums |
| 18622 | enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type |
| 18623 | const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" }; |
| 18624 | 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 |
| 18625 | const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" }; |
| 18626 | if (cfg->ShowWindowsRectsType < 0) |
| 18627 | cfg->ShowWindowsRectsType = WRT_WorkRect; |
| 18628 | if (cfg->ShowTablesRectsType < 0) |
| 18629 | cfg->ShowTablesRectsType = TRT_WorkRect; |
| 18630 | |
| 18631 | struct Funcs |
| 18632 | { |
| 18633 | static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) |
| 18634 | { |
| 18635 | ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance |
| 18636 | if (rect_type == TRT_OuterRect) { return table->OuterRect; } |
| 18637 | else if (rect_type == TRT_InnerRect) { return table->InnerRect; } |
| 18638 | else if (rect_type == TRT_WorkRect) { return table->WorkRect; } |
| 18639 | else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } |
| 18640 | else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } |
| 18641 | else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } |
| 18642 | 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); } |
| 18643 | 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); } |
| 18644 | else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } |
| 18645 | 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 |
| 18646 | 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); } |
| 18647 | 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->LastFirstRowHeight); } |
| 18648 | else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } |
| 18649 | IM_ASSERT(0); |
| 18650 | return ImRect(); |
| 18651 | } |
| 18652 | |
| 18653 | static ImRect GetWindowRect(ImGuiWindow* window, int rect_type) |
nothing calls this directly
no test coverage detected