浏览代码

Tab Bar: zero clear more structures.

ocornut 4 年之前
父节点
当前提交
fbe74ed50c
共有 2 个文件被更改,包括 2 次插入13 次删除
  1. 1 1
      imgui_internal.h
  2. 1 12
      imgui_widgets.cpp

+ 1 - 1
imgui_internal.h

@@ -1740,7 +1740,7 @@ struct ImGuiTabItem
     ImS16               IndexDuringLayout;      // Index only used during TabBarLayout()
     ImS16               IndexDuringLayout;      // Index only used during TabBarLayout()
     bool                WantClose;              // Marked as closed by SetTabItemClosed()
     bool                WantClose;              // Marked as closed by SetTabItemClosed()
 
 
-    ImGuiTabItem()      { ID = 0; Flags = ImGuiTabItemFlags_None; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; BeginOrder = -1; IndexDuringLayout = -1; WantClose = false; }
+    ImGuiTabItem()      { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; NameOffset = BeginOrder = IndexDuringLayout = -1; }
 };
 };
 
 
 // Storage for a tab bar (sizeof() 152 bytes)
 // Storage for a tab bar (sizeof() 152 bytes)

+ 1 - 12
imgui_widgets.cpp

@@ -6802,20 +6802,9 @@ namespace ImGui
 
 
 ImGuiTabBar::ImGuiTabBar()
 ImGuiTabBar::ImGuiTabBar()
 {
 {
-    Flags = ImGuiTabBarFlags_None;
-    ID = 0;
-    SelectedTabId = NextSelectedTabId = VisibleTabId = 0;
+    memset(this, 0, sizeof(*this));
     CurrFrameVisible = PrevFrameVisible = -1;
     CurrFrameVisible = PrevFrameVisible = -1;
-    CurrTabsContentsHeight = PrevTabsContentsHeight = 0.0f;
-    WidthAllTabs = WidthAllTabsIdeal = 0.0f;
-    ScrollingAnim = ScrollingTarget = ScrollingTargetDistToVisibility = ScrollingSpeed = 0.0f;
-    ScrollingRectMinX = ScrollingRectMaxX = 0.0f;
-    ReorderRequestTabId = 0;
-    ReorderRequestDir = 0;
-    TabsActiveCount = 0;
     LastTabItemIdx = -1;
     LastTabItemIdx = -1;
-    BeginCount = 0;
-    WantLayout = VisibleTabWasSubmitted = TabsAddedNew = false;
 }
 }
 
 
 static int IMGUI_CDECL TabItemComparerBySection(const void* lhs, const void* rhs)
 static int IMGUI_CDECL TabItemComparerBySection(const void* lhs, const void* rhs)