Initialize before use in a new frame. We always have a command ready in the buffer.
| 390 | |
| 391 | // Initialize before use in a new frame. We always have a command ready in the buffer. |
| 392 | void ImDrawList::_ResetForNewFrame() |
| 393 | { |
| 394 | // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. |
| 395 | IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0); |
| 396 | IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4)); |
| 397 | IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); |
| 398 | if (_Splitter._Count > 1) |
| 399 | _Splitter.Merge(this); |
| 400 | |
| 401 | CmdBuffer.resize(0); |
| 402 | IdxBuffer.resize(0); |
| 403 | VtxBuffer.resize(0); |
| 404 | Flags = _Data->InitialFlags; |
| 405 | memset(&_CmdHeader, 0, sizeof(_CmdHeader)); |
| 406 | _VtxCurrentIdx = 0; |
| 407 | _VtxWritePtr = NULL; |
| 408 | _IdxWritePtr = NULL; |
| 409 | _ClipRectStack.resize(0); |
| 410 | _TextureIdStack.resize(0); |
| 411 | _Path.resize(0); |
| 412 | _Splitter.Clear(); |
| 413 | CmdBuffer.push_back(ImDrawCmd()); |
| 414 | _FringeScale = 1.0f; |
| 415 | } |
| 416 | |
| 417 | void ImDrawList::_ClearFreeMemory() |
| 418 | { |