| 1687 | } |
| 1688 | |
| 1689 | void ImDrawListSplitter::Split(ImDrawList* draw_list, int channels_count) |
| 1690 | { |
| 1691 | IM_UNUSED(draw_list); |
| 1692 | IM_ASSERT(_Current == 0 && _Count <= 1 && "Nested channel splitting is not supported. Please use separate instances of ImDrawListSplitter."); |
| 1693 | int old_channels_count = _Channels.Size; |
| 1694 | if (old_channels_count < channels_count) |
| 1695 | { |
| 1696 | _Channels.reserve(channels_count); // Avoid over reserving since this is likely to stay stable |
| 1697 | _Channels.resize(channels_count); |
| 1698 | } |
| 1699 | _Count = channels_count; |
| 1700 | |
| 1701 | // Channels[] (24/32 bytes each) hold storage that we'll swap with draw_list->_CmdBuffer/_IdxBuffer |
| 1702 | // 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. |
| 1703 | // 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 |
| 1704 | memset(&_Channels[0], 0, sizeof(ImDrawChannel)); |
| 1705 | for (int i = 1; i < channels_count; i++) |
| 1706 | { |
| 1707 | if (i >= old_channels_count) |
| 1708 | { |
| 1709 | IM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel(); |
| 1710 | } |
| 1711 | else |
| 1712 | { |
| 1713 | _Channels[i]._CmdBuffer.resize(0); |
| 1714 | _Channels[i]._IdxBuffer.resize(0); |
| 1715 | } |
| 1716 | } |
| 1717 | } |
| 1718 | |
| 1719 | void ImDrawListSplitter::Merge(ImDrawList* draw_list) |
| 1720 | { |
no test coverage detected