ImDrawList: Small refactor to create empty command when beginning the frame, allowing to simplify some functions.

+ Missing clearing two fields in ClearFreeMemory() (was hamrless)
This commit is contained in:
ocornut
2020-06-06 20:25:56 +02:00
parent 003153b3ac
commit 0320e7257b
3 changed files with 17 additions and 12 deletions

View File

@ -3777,11 +3777,11 @@ void ImGui::NewFrame()
if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset)
g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset;
g.BackgroundDrawList.Clear();
g.BackgroundDrawList.ResetForNewFrame();
g.BackgroundDrawList.PushTextureID(g.IO.Fonts->TexID);
g.BackgroundDrawList.PushClipRectFullScreen();
g.ForegroundDrawList.Clear();
g.ForegroundDrawList.ResetForNewFrame();
g.ForegroundDrawList.PushTextureID(g.IO.Fonts->TexID);
g.ForegroundDrawList.PushClipRectFullScreen();
@ -5860,7 +5860,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// DRAWING
// Setup draw list and outer clipping rectangle
window->DrawList->Clear();
window->DrawList->ResetForNewFrame();
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
PushClipRect(host_rect.Min, host_rect.Max, false);