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