Initialize before use in a new frame. We always have a command ready in the buffer. In the majority of cases, you would want to call PushClipRect() and PushTexture() after this.
| 437 | // Initialize before use in a new frame. We always have a command ready in the buffer. |
| 438 | // In the majority of cases, you would want to call PushClipRect() and PushTexture() after this. |
| 439 | void ImDrawList::_ResetForNewFrame() |
| 440 | { |
| 441 | // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. |
| 442 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); |
| 443 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, TexRef) == sizeof(ImVec4)); |
| 444 | IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureRef)); |
| 445 | if (_Splitter._Count > 1) |
| 446 | _Splitter.Merge(this); |
| 447 | |
| 448 | CmdBuffer.resize(0); |
| 449 | IdxBuffer.resize(0); |
| 450 | VtxBuffer.resize(0); |
| 451 | Flags = _Data->InitialFlags; |
| 452 | memset(&_CmdHeader, 0, sizeof(_CmdHeader)); |
| 453 | _VtxCurrentIdx = 0; |
| 454 | _VtxWritePtr = NULL; |
| 455 | _IdxWritePtr = NULL; |
| 456 | _ClipRectStack.resize(0); |
| 457 | _TextureStack.resize(0); |
| 458 | _CallbacksDataBuf.resize(0); |
| 459 | _Path.resize(0); |
| 460 | _Splitter.Clear(); |
| 461 | CmdBuffer.push_back(ImDrawCmd()); |
| 462 | _FringeScale = _Data->InitialFringeScale; |
| 463 | } |
| 464 | |
| 465 | void ImDrawList::_ClearFreeMemory() |
| 466 | { |