MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / PrimReserve

Method PrimReserve

KBotExt/imgui/imgui_draw.cpp:619–642  ·  view source on GitHub ↗

Reserve space for a number of vertices and indices. You must finish filling your reserved data before calling PrimReserve() again, as it may reallocate or submit the intermediate results. PrimUnreserve() can be used to release unused allocations.

Source from the content-addressed store, hash-verified

617// You must finish filling your reserved data before calling PrimReserve() again, as it may reallocate or
618// submit the intermediate results. PrimUnreserve() can be used to release unused allocations.
619void ImDrawList::PrimReserve(int idx_count, int vtx_count)
620{
621 // Large mesh support (when enabled)
622 IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
623 if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset))
624 {
625 // FIXME: In theory we should be testing that vtx_count <64k here.
626 // In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us
627 // to not make that check until we rework the text functions to handle clipping and large horizontal lines better.
628 _CmdHeader.VtxOffset = VtxBuffer.Size;
629 _OnChangedVtxOffset();
630 }
631
632 ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
633 draw_cmd->ElemCount += idx_count;
634
635 int vtx_buffer_old_size = VtxBuffer.Size;
636 VtxBuffer.resize(vtx_buffer_old_size + vtx_count);
637 _VtxWritePtr = VtxBuffer.Data + vtx_buffer_old_size;
638
639 int idx_buffer_old_size = IdxBuffer.Size;
640 IdxBuffer.resize(idx_buffer_old_size + idx_count);
641 _IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size;
642}
643
644// Release the a number of reserved vertices/indices from the end of the last reservation made with PrimReserve().
645void ImDrawList::PrimUnreserve(int idx_count, int vtx_count)

Callers 3

RenderCharMethod · 0.80
RenderTextMethod · 0.80
ColorPicker4Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected