ImDrawData: Slight refactor so internal logic uses same logic as AddDrawList(). (#6406, #4879, #1878)

# Conflicts:
#	imgui.cpp
#	imgui_internal.h
This commit is contained in:
ocornut
2023-07-12 17:31:50 +02:00
parent 1a9ddd2396
commit dbeeeae593
3 changed files with 66 additions and 67 deletions

View File

@ -776,8 +776,6 @@ struct ImDrawDataBuilder
ImVector<ImDrawList*> LayerData1;
ImDrawDataBuilder() { memset(this, 0, sizeof(*this)); }
void Setup(ImDrawData* draw_data) { Layers[0] = &draw_data->CmdLists; Layers[1] = &LayerData1; for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n]->resize(0); }
IMGUI_API void FlattenIntoSingleLayer();
};
//-----------------------------------------------------------------------------
@ -2802,6 +2800,7 @@ namespace ImGui
inline ImDrawList* GetForegroundDrawList(ImGuiWindow* window) { IM_UNUSED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.
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 void AddDrawListToDrawDataEx(ImDrawData* draw_data, ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
// Init
IMGUI_API void Initialize();