1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-25 02:24:24 +00:00

Shuffle a few internal context fields to reduce padding.

This commit is contained in:
ocornut 2025-10-28 19:01:57 +01:00
parent a1632c6116
commit 8019d39545
3 changed files with 27 additions and 26 deletions

View file

@ -4043,6 +4043,13 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
InputTextState.Ctx = this;
Initialized = false;
WithinFrameScope = WithinFrameScopeWithImplicitWindow = false;
TestEngineHookItems = false;
FrameCount = 0;
FrameCountEnded = FrameCountRendered = -1;
Time = 0.0f;
memset(ContextName, 0, sizeof(ContextName));
Font = NULL;
FontBaked = NULL;
FontSize = FontSizeBase = FontBakedScale = CurrentDpiScale = 0.0f;
@ -4050,15 +4057,8 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
if (shared_font_atlas == NULL)
IO.Fonts->OwnerContext = this;
Time = 0.0f;
FrameCount = 0;
FrameCountEnded = FrameCountRendered = -1;
WithinEndChildID = 0;
WithinFrameScope = WithinFrameScopeWithImplicitWindow = false;
GcCompactAll = false;
TestEngineHookItems = false;
TestEngine = NULL;
memset(ContextName, 0, sizeof(ContextName));
InputEventsNextMouseSource = ImGuiMouseSource_Mouse;
InputEventsNextEventId = 1;
@ -4093,10 +4093,10 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
ActiveIdHasBeenEditedThisFrame = false;
ActiveIdFromShortcut = false;
ActiveIdClickOffset = ImVec2(-1, -1);
ActiveIdWindow = NULL;
ActiveIdSource = ImGuiInputSource_None;
ActiveIdDisabledId = 0;
ActiveIdWindow = NULL;
ActiveIdMouseButton = -1;
ActiveIdDisabledId = 0;
ActiveIdPreviousFrame = 0;
memset(&DeactivatedItemData, 0, sizeof(DeactivatedItemData));
memset(&ActiveIdValueOnActivation, 0, sizeof(ActiveIdValueOnActivation));
@ -4111,6 +4111,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
CurrentFocusScopeId = 0;
CurrentItemFlags = ImGuiItemFlags_None;
DebugShowGroupRects = false;
GcCompactAll = false;
NavCursorVisible = false;
NavHighlightItemUnderNav = false;
@ -4219,12 +4220,12 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
memset(LocalizationTable, 0, sizeof(LocalizationTable));
LogEnabled = false;
LogLineFirstItem = false;
LogFlags = ImGuiLogFlags_None;
LogWindow = NULL;
LogNextPrefix = LogNextSuffix = NULL;
LogFile = NULL;
LogLinePosY = FLT_MAX;
LogLineFirstItem = false;
LogDepthRef = 0;
LogDepthToExpand = LogDepthToExpandDefault = 2;
@ -4457,8 +4458,8 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NUL
MoveId = GetID("#MOVE");
ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
AutoFitFramesX = AutoFitFramesY = -1;
AutoPosLastDirection = ImGuiDir_None;
AutoFitFramesX = AutoFitFramesY = -1;
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = 0;
SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);
LastFrameActive = -1;