MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / _ResetForNewFrame

Method _ResetForNewFrame

ImGUI GLFW Tutorial/imgui/imgui_draw.cpp:402–424  ·  view source on GitHub ↗

Initialize before use in a new frame. We always have a command ready in the buffer.

Source from the content-addressed store, hash-verified

400
401// Initialize before use in a new frame. We always have a command ready in the buffer.
402void 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
426void ImDrawList::_ClearFreeMemory()
427{

Callers 2

GetViewportDrawListFunction · 0.45
BeginMethod · 0.45

Calls 3

ImDrawCmdClass · 0.70
ClearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected