Skip to content

Commit

Permalink
Internals: Initialize drawlist earlier in Begin() to facilitate detec…
Browse files Browse the repository at this point in the history
…ting accidental draw earlier than legal. (#3311)
  • Loading branch information
ocornut committed Jun 20, 2020
1 parent 99f68d7 commit 1a1dcea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5606,6 +5606,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
window->HasCloseButton = (p_open != NULL);
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
window->IDStack.resize(1);
window->DrawList->_ResetForNewFrame();

// Restore buffer capacity when woken from a compacted state, to avoid
if (window->MemoryCompacted)
Expand Down Expand Up @@ -5883,7 +5884,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// DRAWING

// Setup draw list and outer clipping rectangle
window->DrawList->_ResetForNewFrame();
IM_ASSERT(window->DrawList->CmdBuffer.Size == 1 && window->DrawList->CmdBuffer[0].ElemCount == 0);
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
PushClipRect(host_rect.Min, host_rect.Max, false);

Expand Down

0 comments on commit 1a1dcea

Please sign in to comment.