Internals: zero-clearing ImGuiWindow / ImGuiWindowTempData for simplicity. (amend)

All the non-zero fields previously initialized in ImGuiWindowTempData() are in fact setup in Begin: FocusCounterRegular, FocusCounterTabStop, TextWrapPos, LayoutType, ParentLayoutType
This commit is contained in:
ocornut
2020-11-12 12:01:49 +01:00
parent 7a135a763c
commit 13258f5957
2 changed files with 6 additions and 82 deletions

View File

@ -1503,7 +1503,8 @@ struct ImGuiContext
//-----------------------------------------------------------------------------
// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow.
// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered.
// (That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered..)
// (This doesn't need a constructor because we zero-clear it as part of ImGuiWindow and all frame-temporary data are setup on Begin)
struct IMGUI_API ImGuiWindowTempData
{
// Layout
@ -1557,40 +1558,6 @@ struct IMGUI_API ImGuiWindowTempData
ImVector<float> TextWrapPosStack;
ImVector<ImGuiGroupData>GroupStack;
short StackSizesBackup[6]; // Store size of various stacks for asserting
ImGuiWindowTempData()
{
CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f);
CurrLineSize = PrevLineSize = ImVec2(0.0f, 0.0f);
CurrLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
Indent = ImVec1(0.0f);
ColumnsOffset = ImVec1(0.0f);
GroupOffset = ImVec1(0.0f);
LastItemId = 0;
LastItemStatusFlags = ImGuiItemStatusFlags_None;
LastItemRect = LastItemDisplayRect = ImRect();
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
NavLayerCurrent = ImGuiNavLayer_Main;
NavFocusScopeIdCurrent = 0;
NavHideHighlightOneFrame = false;
NavHasScroll = false;
MenuBarAppending = false;
MenuBarOffset = ImVec2(0.0f, 0.0f);
TreeDepth = 0;
TreeJumpToParentOnPopMask = 0x00;
StateStorage = NULL;
CurrentColumns = NULL;
LayoutType = ParentLayoutType = ImGuiLayoutType_Vertical;
FocusCounterRegular = FocusCounterTabStop = -1;
ItemFlags = ImGuiItemFlags_Default_;
ItemWidth = 0.0f;
TextWrapPos = -1.0f;
memset(StackSizesBackup, 0, sizeof(StackSizesBackup));
}
};
// Storage for one window