MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / GetViewportDrawList

Function GetViewportDrawList

ImGUI GLFW Tutorial/imgui/imgui.cpp:3460–3482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3458}
3459
3460static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name)
3461{
3462 // Create the draw list on demand, because they are not frequently used for all viewports
3463 ImGuiContext& g = *GImGui;
3464 IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists));
3465 ImDrawList* draw_list = viewport->DrawLists[drawlist_no];
3466 if (draw_list == NULL)
3467 {
3468 draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData);
3469 draw_list->_OwnerName = drawlist_name;
3470 viewport->DrawLists[drawlist_no] = draw_list;
3471 }
3472
3473 // Our ImDrawList system requires that there is always a command
3474 if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount)
3475 {
3476 draw_list->_ResetForNewFrame();
3477 draw_list->PushTextureID(g.IO.Fonts->TexID);
3478 draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false);
3479 viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount;
3480 }
3481 return draw_list;
3482}
3483
3484ImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport)
3485{

Callers 2

GetBackgroundDrawListMethod · 0.70
GetForegroundDrawListMethod · 0.70

Calls 3

_ResetForNewFrameMethod · 0.45
PushTextureIDMethod · 0.45
PushClipRectMethod · 0.45

Tested by

no test coverage detected