MCPcopy Create free account
hub / github.com/RenderKit/embree / RenderDimmedBackgrounds

Method RenderDimmedBackgrounds

tutorials/common/imgui/imgui.cpp:5089–5125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5087}
5088
5089static void ImGui::RenderDimmedBackgrounds()
5090{
5091 ImGuiContext& g = *GImGui;
5092 ImGuiWindow* modal_window = GetTopMostAndVisiblePopupModal();
5093 if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f)
5094 return;
5095 const bool dim_bg_for_modal = (modal_window != NULL);
5096 const bool dim_bg_for_window_list = (g.NavWindowingTargetAnim != NULL && g.NavWindowingTargetAnim->Active);
5097 if (!dim_bg_for_modal && !dim_bg_for_window_list)
5098 return;
5099
5100 if (dim_bg_for_modal)
5101 {
5102 // Draw dimming behind modal or a begin stack child, whichever comes first in draw order.
5103 ImGuiWindow* dim_behind_window = FindBottomMostVisibleWindowWithinBeginStack(modal_window);
5104 RenderDimmedBackgroundBehindWindow(dim_behind_window, GetColorU32(ImGuiCol_ModalWindowDimBg, g.DimBgRatio));
5105 }
5106 else if (dim_bg_for_window_list)
5107 {
5108 // Draw dimming behind CTRL+Tab target window
5109 RenderDimmedBackgroundBehindWindow(g.NavWindowingTargetAnim, GetColorU32(ImGuiCol_NavWindowingDimBg, g.DimBgRatio));
5110
5111 // Draw border around CTRL+Tab target window
5112 ImGuiWindow* window = g.NavWindowingTargetAnim;
5113 ImGuiViewport* viewport = GetMainViewport();
5114 float distance = g.FontSize;
5115 ImRect bb = window->Rect();
5116 bb.Expand(distance);
5117 if (bb.GetWidth() >= viewport->Size.x && bb.GetHeight() >= viewport->Size.y)
5118 bb.Expand(-distance - 1.0f); // If a window fits the entire viewport, adjust its highlight inward
5119 if (window->DrawList->CmdBuffer.Size == 0)
5120 window->DrawList->AddDrawCmd();
5121 window->DrawList->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size);
5122 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), window->WindowRounding, 0, 3.0f);
5123 window->DrawList->PopClipRect();
5124 }
5125}
5126
5127// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal.
5128void ImGui::EndFrame()

Callers

nothing calls this directly

Calls 4

AddDrawCmdMethod · 0.80
AddRectMethod · 0.80
PushClipRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected