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

Method RenderDimmedBackgroundBehindWindow

KBotExt/imgui/imgui.cpp:4882–4907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4880}
4881
4882static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col)
4883{
4884 if ((col & IM_COL32_A_MASK) == 0)
4885 return;
4886
4887 ImGuiViewportP* viewport = (ImGuiViewportP*)GetMainViewport();
4888 ImRect viewport_rect = viewport->GetMainRect();
4889
4890 // Draw behind window by moving the draw command at the FRONT of the draw list
4891 {
4892 // We've already called AddWindowToDrawData() which called DrawList->ChannelsMerge() on DockNodeHost windows,
4893 // and draw list have been trimmed already, hence the explicit recreation of a draw command if missing.
4894 // 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.
4895 ImDrawList* draw_list = window->RootWindow->DrawList;
4896 if (draw_list->CmdBuffer.Size == 0)
4897 draw_list->AddDrawCmd();
4898 draw_list->PushClipRect(viewport_rect.Min - ImVec2(1, 1), viewport_rect.Max + ImVec2(1, 1), false); // FIXME: Need to stricty ensure ImDrawCmd are not merged (ElemCount==6 checks below will verify that)
4899 draw_list->AddRectFilled(viewport_rect.Min, viewport_rect.Max, col);
4900 ImDrawCmd cmd = draw_list->CmdBuffer.back();
4901 IM_ASSERT(cmd.ElemCount == 6);
4902 draw_list->CmdBuffer.pop_back();
4903 draw_list->CmdBuffer.push_front(cmd);
4904 draw_list->AddDrawCmd(); // We need to create a command as CmdBuffer.back().IdxOffset won't be correct if we append to same command.
4905 draw_list->PopClipRect();
4906 }
4907}
4908
4909ImGuiWindow* ImGui::FindBottomMostVisibleWindowWithinBeginStack(ImGuiWindow* parent_window)
4910{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected