MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / DebugRenderViewportThumbnail

Method DebugRenderViewportThumbnail

KBotExt/imgui/imgui.cpp:13464–13491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13462#ifndef IMGUI_DISABLE_DEBUG_TOOLS
13463
13464void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb)
13465{
13466 ImGuiContext& g = *GImGui;
13467 ImGuiWindow* window = g.CurrentWindow;
13468
13469 ImVec2 scale = bb.GetSize() / viewport->Size;
13470 ImVec2 off = bb.Min - viewport->Pos * scale;
13471 float alpha_mul = 1.0f;
13472 window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f));
13473 for (ImGuiWindow* thumb_window : g.Windows)
13474 {
13475 if (!thumb_window->WasActive || (thumb_window->Flags & ImGuiWindowFlags_ChildWindow))
13476 continue;
13477
13478 ImRect thumb_r = thumb_window->Rect();
13479 ImRect title_r = thumb_window->TitleBarRect();
13480 thumb_r = ImRect(ImFloor(off + thumb_r.Min * scale), ImFloor(off + thumb_r.Max * scale));
13481 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
13482 thumb_r.ClipWithFull(bb);
13483 title_r.ClipWithFull(bb);
13484 const bool window_is_focused = (g.NavWindow && thumb_window->RootWindowForTitleBarHighlight == g.NavWindow->RootWindowForTitleBarHighlight);
13485 window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));
13486 window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));
13487 window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
13488 window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));
13489 }
13490 draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
13491}
13492
13493static void RenderViewportsThumbnails()
13494{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected