mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-13 18:50:58 +01:00
parent
546b728199
commit
42c98c5eea
@ -568,7 +568,10 @@ void ImDrawList::ChannelsMerge()
|
|||||||
if (CmdBuffer.Size && CmdBuffer.back().ElemCount == 0)
|
if (CmdBuffer.Size && CmdBuffer.back().ElemCount == 0)
|
||||||
CmdBuffer.pop_back();
|
CmdBuffer.pop_back();
|
||||||
|
|
||||||
int new_cmd_buffer_count = 0, new_idx_buffer_count = 0;
|
// Calculate our final buffer sizes. Also fix the incorrect IdxOffset values in each command.
|
||||||
|
int new_cmd_buffer_count = 0;
|
||||||
|
int new_idx_buffer_count = 0;
|
||||||
|
int idx_offset = CmdBuffer.back().IdxOffset + CmdBuffer.back().ElemCount;
|
||||||
for (int i = 1; i < _ChannelsCount; i++)
|
for (int i = 1; i < _ChannelsCount; i++)
|
||||||
{
|
{
|
||||||
ImDrawChannel& ch = _Channels[i];
|
ImDrawChannel& ch = _Channels[i];
|
||||||
@ -576,10 +579,16 @@ void ImDrawList::ChannelsMerge()
|
|||||||
ch.CmdBuffer.pop_back();
|
ch.CmdBuffer.pop_back();
|
||||||
new_cmd_buffer_count += ch.CmdBuffer.Size;
|
new_cmd_buffer_count += ch.CmdBuffer.Size;
|
||||||
new_idx_buffer_count += ch.IdxBuffer.Size;
|
new_idx_buffer_count += ch.IdxBuffer.Size;
|
||||||
|
for (int cmd_n = 0; cmd_n < ch.CmdBuffer.Size; cmd_n++)
|
||||||
|
{
|
||||||
|
ch.CmdBuffer.Data[cmd_n].IdxOffset = idx_offset;
|
||||||
|
idx_offset += ch.CmdBuffer.Data[cmd_n].ElemCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CmdBuffer.resize(CmdBuffer.Size + new_cmd_buffer_count);
|
CmdBuffer.resize(CmdBuffer.Size + new_cmd_buffer_count);
|
||||||
IdxBuffer.resize(IdxBuffer.Size + new_idx_buffer_count);
|
IdxBuffer.resize(IdxBuffer.Size + new_idx_buffer_count);
|
||||||
|
|
||||||
|
// Flatten our N channels at the end of the first one.
|
||||||
ImDrawCmd* cmd_write = CmdBuffer.Data + CmdBuffer.Size - new_cmd_buffer_count;
|
ImDrawCmd* cmd_write = CmdBuffer.Data + CmdBuffer.Size - new_cmd_buffer_count;
|
||||||
_IdxWritePtr = IdxBuffer.Data + IdxBuffer.Size - new_idx_buffer_count;
|
_IdxWritePtr = IdxBuffer.Data + IdxBuffer.Size - new_idx_buffer_count;
|
||||||
for (int i = 1; i < _ChannelsCount; i++)
|
for (int i = 1; i < _ChannelsCount; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user