瀏覽代碼

ImDrawList: Fixed a bug in ChannelsMerge() leading to an extraneous draw call being created, which unexpectly led to more dramatic condition but to faulty draw command merging code. (#1172, #1368)

omar 8 年之前
父節點
當前提交
e32569dd5a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      imgui_draw.cpp

+ 1 - 1
imgui_draw.cpp

@@ -339,7 +339,7 @@ void ImDrawList::ChannelsMerge()
         if (int sz = ch.CmdBuffer.Size) { memcpy(cmd_write, ch.CmdBuffer.Data, sz * sizeof(ImDrawCmd)); cmd_write += sz; }
         if (int sz = ch.IdxBuffer.Size) { memcpy(_IdxWritePtr, ch.IdxBuffer.Data, sz * sizeof(ImDrawIdx)); _IdxWritePtr += sz; }
     }
-    AddDrawCmd();
+    UpdateClipRect(); // We call this instead of AddDrawCmd(), so that empty channels won't produce an extra draw call.
     _ChannelsCount = 1;
 }