Merged GetBackgroundDrawList()/GetForegroundDrawList() and GetBackgroundDrawList(ImGuiViewport* viewport)/GetForegroundDrawList(ImGuiViewport* viewport) api entry points.

This commit is contained in:
ocornut 2024-06-28 16:16:51 +02:00
parent 138d9d0c21
commit 3fec562da1
3 changed files with 10 additions and 16 deletions

View File

@ -105,6 +105,10 @@ Docking+Viewports Branch:
- Windows, Menus: Fixed an issue where the size of sub-menu in their own viewport
would be erroneously clamped to the size of main viewport. (#7730)
- Merged GetBackgroundDrawList() and GetBackgroundDrawList(ImGuiViewport* viewport)
api entry points into a same one GetBackgroundDrawList(ImGuiViewport* viewport = NULL);
- Merged GetForegroundDrawList() and GetForegroundDrawList(ImGuiViewport* viewport)
api entry points into a same one GetForegroundDrawList(ImGuiViewport* viewport = NULL);
- Backends: SDL3: Update for introduction of SDL_GLContext from void*. (#7701, #7702)
[@bcsanches]
- Backends: Win32: Secondary viewports WndProc handler retrieve/set imgui context from

View File

@ -4519,26 +4519,18 @@ static ImDrawList* GetViewportBgFgDrawList(ImGuiViewportP* viewport, size_t draw
ImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport)
{
if (viewport == NULL)
viewport = GImGui->CurrentWindow->Viewport;
return GetViewportBgFgDrawList((ImGuiViewportP*)viewport, 0, "##Background");
}
ImDrawList* ImGui::GetBackgroundDrawList()
{
ImGuiContext& g = *GImGui;
return GetBackgroundDrawList(g.CurrentWindow->Viewport);
}
ImDrawList* ImGui::GetForegroundDrawList(ImGuiViewport* viewport)
{
if (viewport == NULL)
viewport = GImGui->CurrentWindow->Viewport;
return GetViewportBgFgDrawList((ImGuiViewportP*)viewport, 1, "##Foreground");
}
ImDrawList* ImGui::GetForegroundDrawList()
{
ImGuiContext& g = *GImGui;
return GetForegroundDrawList(g.CurrentWindow->Viewport);
}
ImDrawListSharedData* ImGui::GetDrawListSharedData()
{
return &GImGui->DrawListSharedData;

View File

@ -935,10 +935,8 @@ namespace ImGui
IMGUI_API ImGuiViewport* GetMainViewport(); // return primary/default viewport. This can never be NULL.
// Background/Foreground Draw Lists
IMGUI_API ImDrawList* GetBackgroundDrawList(); // get background draw list for the viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.
IMGUI_API ImDrawList* GetForegroundDrawList(); // get foreground draw list for the viewport associated to the current window. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.
IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.
IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents.
IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport = NULL); // get background draw list for the given viewport or viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents.
IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport = NULL); // get foreground draw list for the given viewport or viewport associated to the current window. this draw list will be the top-most rendered one. Useful to quickly draw shapes/text over dear imgui contents.
// Miscellaneous Utilities
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped.