mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
ImDrawList: fixed index overflow check broken by AddText(). Added extra assert. (#514)
This commit is contained in:
parent
a3b00b79f2
commit
2efaa9a86f
@ -2289,7 +2289,8 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
|
||||
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
|
||||
const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8);
|
||||
(void)max_vtx_idx;
|
||||
IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList
|
||||
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Sanity check. Bug or mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
||||
IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList. See comment above.
|
||||
|
||||
GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size;
|
||||
GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;
|
||||
|
@ -903,7 +903,7 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos,
|
||||
CmdBuffer.back().ElemCount -= idx_unused;
|
||||
_VtxWritePtr -= vtx_unused;
|
||||
_IdxWritePtr -= idx_unused;
|
||||
_VtxCurrentIdx = (ImDrawIdx)VtxBuffer.Size;
|
||||
_VtxCurrentIdx = (unsigned int)VtxBuffer.Size;
|
||||
}
|
||||
|
||||
// This is one of the few function breaking the encapsulation of ImDrawLst, but it is just so useful.
|
||||
|
Loading…
Reference in New Issue
Block a user