MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / DebugRenderViewportThumbnail

Method DebugRenderViewportThumbnail

plugins/Cardinal/src/DearImGui/imgui.cpp:11524–11552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11522#ifndef IMGUI_DISABLE_METRICS_WINDOW
11523
11524void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)
11525{
11526 ImGuiContext& g = *GImGui;
11527 ImGuiWindow* window = g.CurrentWindow;
11528
11529 ImVec2 scale = bb.GetSize() / viewport->Size;
11530 ImVec2 off = bb.Min - viewport->Pos * scale;
11531 float alpha_mul = 1.0f;
11532 window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f));
11533 for (int i = 0; i != g.Windows.Size; i++)
11534 {
11535 ImGuiWindow* thumb_window = g.Windows[i];
11536 if (!thumb_window->WasActive || (thumb_window->Flags & ImGuiWindowFlags_ChildWindow))
11537 continue;
11538
11539 ImRect thumb_r = thumb_window->Rect();
11540 ImRect title_r = thumb_window->TitleBarRect();
11541 thumb_r = ImRect(ImFloor(off + thumb_r.Min * scale), ImFloor(off + thumb_r.Max * scale));
11542 title_r = ImRect(ImFloor(off + title_r.Min * scale), ImFloor(off + ImVec2(title_r.Max.x, title_r.Min.y) * scale) + ImVec2(0,5)); // Exaggerate title bar height
11543 thumb_r.ClipWithFull(bb);
11544 title_r.ClipWithFull(bb);
11545 const bool window_is_focused = (g.NavWindow && thumb_window->RootWindowForTitleBarHighlight == g.NavWindow->RootWindowForTitleBarHighlight);
11546 window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));
11547 window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));
11548 window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
11549 window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));
11550 }
11551 draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
11552}
11553
11554static void RenderViewportsThumbnails()
11555{

Callers

nothing calls this directly

Calls 7

ImFloorFunction · 0.85
ImVec2Function · 0.85
AddRectFilledMethod · 0.80
RectMethod · 0.80
AddRectMethod · 0.80
AddTextMethod · 0.80
ImRectFunction · 0.70

Tested by

no test coverage detected