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

Method Split

KBotExt/imgui/imgui_draw.cpp:1684–1712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1682}
1683
1684void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count)
1685{
1686 IM_UNUSED(draw_list);
1687 IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.");
1688 int old_channels_count = _Channels.Size;
1689 if (old_channels_count < channels_count)
1690 {
1691 _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable
1692 _Channels.resize(channels_count);
1693 }
1694 _Count = channels_count;
1695
1696 // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_CmdBuffer/_IdxBuffer
1697 // The content of Channels[0] at this point doesn't matter. We clear it to make state tidy in a debugger but we don't strictly need to.
1698 // When we switch to the next channel, we'll copy draw_list->_CmdBuffer/_IdxBuffer into Channels[0] and then Channels[1] into draw_list->CmdBuffer/_IdxBuffer
1699 memset(&_Channels[0], 0, sizeof(ImDrawChannel));
1700 for (int i = 1; i < channels_count; i++)
1701 {
1702 if (i >= old_channels_count)
1703 {
1704 IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();
1705 }
1706 else
1707 {
1708 _Channels[i]._CmdBuffer.resize(0);
1709 _Channels[i]._IdxBuffer.resize(0);
1710 }
1711 }
1712}
1713
1714void ImDrawListSplitter::Merge(ImDrawList* draw_list)
1715{

Callers 3

BeginColumnsMethod · 0.80
ChannelsSplitMethod · 0.80

Calls 2

ImDrawChannelClass · 0.85
reserveMethod · 0.80

Tested by

no test coverage detected