Initialize before use in a new frame. We always have a command ready in the buffer.
| 400 | |
| 401 | // Initialize before use in a new frame. We always have a command ready in the buffer. |
| 402 | void ImDrawList::_ResetForNewFrame() |
| 403 | { |
| 404 | // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. |
| 405 | // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC) |
| 406 | IM_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0); |
| 407 | IM_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4)); |
| 408 | IM_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); |
| 409 | |
| 410 | CmdBuffer.resize(0); |
| 411 | IdxBuffer.resize(0); |
| 412 | VtxBuffer.resize(0); |
| 413 | Flags = _Data->InitialFlags; |
| 414 | memset(&_CmdHeader, 0, sizeof(_CmdHeader)); |
| 415 | _VtxCurrentIdx = 0; |
| 416 | _VtxWritePtr = NULL; |
| 417 | _IdxWritePtr = NULL; |
| 418 | _ClipRectStack.resize(0); |
| 419 | _TextureIdStack.resize(0); |
| 420 | _Path.resize(0); |
| 421 | _Splitter.Clear(); |
| 422 | CmdBuffer.push_back(ImDrawCmd()); |
| 423 | _FringeScale = 1.0f; |
| 424 | } |
| 425 | |
| 426 | void ImDrawList::_ClearFreeMemory() |
| 427 | { |
no test coverage detected