MCPcopy Create free account
hub / github.com/AlexandreRouma/SDRPlusPlus / Split

Method Split

core/src/imgui/imgui_draw.cpp:1675–1703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673}
1674
1675void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count)
1676{
1677 IM_UNUSED(draw_list);
1678 IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter.");
1679 int old_channels_count = _Channels.Size;
1680 if (old_channels_count < channels_count)
1681 {
1682 _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable
1683 _Channels.resize(channels_count);
1684 }
1685 _Count = channels_count;
1686
1687 // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_CmdBuffer/_IdxBuffer
1688 // 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.
1689 // 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
1690 memset(&_Channels[0], 0, sizeof(ImDrawChannel));
1691 for (int i = 1; i < channels_count; i++)
1692 {
1693 if (i >= old_channels_count)
1694 {
1695 IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();
1696 }
1697 else
1698 {
1699 _Channels[i]._CmdBuffer.resize(0);
1700 _Channels[i]._IdxBuffer.resize(0);
1701 }
1702 }
1703}
1704
1705void ImDrawListSplitter::Merge(ImDrawList* draw_list)
1706{

Callers 3

BeginColumnsMethod · 0.80
ChannelsSplitMethod · 0.80

Calls 3

ImDrawChannelClass · 0.85
resizeMethod · 0.80
reserveMethod · 0.45

Tested by

no test coverage detected