MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / GetViewportDrawList

Function GetViewportDrawList

extern/imgui/imgui.cpp:4038–4060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4036}
4037
4038static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name)
4039{
4040 // Create the draw list on demand, because they are not frequently used for all viewports
4041 ImGuiContext& g = *GImGui;
4042 IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists));
4043 ImDrawList* draw_list = viewport->DrawLists[drawlist_no];
4044 if (draw_list == NULL)
4045 {
4046 draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData);
4047 draw_list->_OwnerName = drawlist_name;
4048 viewport->DrawLists[drawlist_no] = draw_list;
4049 }
4050
4051 // Our ImDrawList system requires that there is always a command
4052 if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount)
4053 {
4054 draw_list->_ResetForNewFrame();
4055 draw_list->PushTextureID(g.IO.Fonts->TexID);
4056 draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false);
4057 viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount;
4058 }
4059 return draw_list;
4060}
4061
4062ImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport)
4063{

Callers 2

GetBackgroundDrawListMethod · 0.85
GetForegroundDrawListMethod · 0.85

Calls 3

_ResetForNewFrameMethod · 0.80
PushTextureIDMethod · 0.80
PushClipRectMethod · 0.45

Tested by

no test coverage detected