| 2044 | } |
| 2045 | |
| 2046 | void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count) |
| 2047 | { |
| 2048 | IM_UNUSED(draw_list); |
| 2049 | IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter."); |
| 2050 | int old_channels_count = _Channels.Size; |
| 2051 | if (old_channels_count < channels_count) |
| 2052 | { |
| 2053 | _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable |
| 2054 | _Channels.resize(channels_count); |
| 2055 | } |
| 2056 | _Count = channels_count; |
| 2057 | |
| 2058 | // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_CmdBuffer/_IdxBuffer |
| 2059 | // 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. |
| 2060 | // 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 |
| 2061 | memset(&_Channels[0], 0, sizeof(ImDrawChannel)); |
| 2062 | for (int i = 1; i < channels_count; i++) |
| 2063 | { |
| 2064 | if (i >= old_channels_count) |
| 2065 | { |
| 2066 | IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel(); |
| 2067 | } |
| 2068 | else |
| 2069 | { |
| 2070 | _Channels[i]._CmdBuffer.resize(0); |
| 2071 | _Channels[i]._IdxBuffer.resize(0); |
| 2072 | } |
| 2073 | } |
| 2074 | } |
| 2075 | |
| 2076 | void ImDrawListSplitter::Merge(ImDrawList* draw_list) |
| 2077 | { |
no test coverage detected