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

Method RenderDimmedBackgroundBehindWindow

tutorials/common/imgui/imgui.cpp:5045–5070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5043}
5044
5045static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col)
5046{
5047 if ((col & IM_COL32_A_MASK) == 0)
5048 return;
5049
5050 ImGuiViewportP* viewport = (ImGuiViewportP*)GetMainViewport();
5051 ImRect viewport_rect = viewport->GetMainRect();
5052
5053 // Draw behind window by moving the draw command at the FRONT of the draw list
5054 {
5055 // We've already called AddWindowToDrawData() which called DrawList->ChannelsMerge() on DockNodeHost windows,
5056 // and draw list have been trimmed already, hence the explicit recreation of a draw command if missing.
5057 // FIXME: This is creating complication, might be simpler if we could inject a drawlist in drawdata at a given position and not attempt to manipulate ImDrawCmd order.
5058 ImDrawList* draw_list = window->RootWindow->DrawList;
5059 if (draw_list->CmdBuffer.Size == 0)
5060 draw_list->AddDrawCmd();
5061 draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // Ensure ImDrawCmd are not merged
5062 draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col);
5063 ImDrawCmd cmd = draw_list->CmdBuffer.back();
5064 IM_ASSERT(cmd.ElemCount == 6);
5065 draw_list->CmdBuffer.pop_back();
5066 draw_list->CmdBuffer.push_front(cmd);
5067 draw_list->PopClipRect();
5068 draw_list->AddDrawCmd(); // We need to create a command as CmdBuffer.back().IdxOffset won't be correct if we append to same command.
5069 }
5070}
5071
5072ImGuiWindow* ImGui::FindBottomMostVisibleWindowWithinBeginStack(ImGuiWindow* parent_window)
5073{

Callers

nothing calls this directly

Calls 7

ImVec2Function · 0.85
GetMainRectMethod · 0.80
AddDrawCmdMethod · 0.80
AddRectFilledMethod · 0.80
PushClipRectMethod · 0.45
pop_backMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected