1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-09-24 03:28:33 +02:00

ImDrawList: Fixed a (rarely occuring) bug with merging with previous command + unnecessary OverlayDrawList command

This commit is contained in:
ocornut 2016-06-11 15:42:10 +02:00
parent 3fd3eac370
commit d79186931e
2 changed files with 1 additions and 2 deletions

View File

@ -2066,7 +2066,6 @@ void ImGui::NewFrame()
g.OverlayDrawList.Clear(); g.OverlayDrawList.Clear();
g.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID); g.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID);
g.OverlayDrawList.PushClipRectFullScreen(); g.OverlayDrawList.PushClipRectFullScreen();
g.OverlayDrawList.AddDrawCmd();
// Mark rendering data as invalid to prevent user who may have a handle on it to use it // Mark rendering data as invalid to prevent user who may have a handle on it to use it
g.RenderDrawData.Valid = false; g.RenderDrawData.Valid = false;

View File

@ -196,7 +196,7 @@ void ImDrawList::UpdateClipRect()
// Try to merge with previous command if it matches, else use current command // Try to merge with previous command if it matches, else use current command
ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL; ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
if (prev_cmd && memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL) if (curr_cmd->ElemCount == 0 && prev_cmd && memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)
CmdBuffer.pop_back(); CmdBuffer.pop_back();
else else
curr_cmd->ClipRect = curr_clip_rect; curr_cmd->ClipRect = curr_clip_rect;