diff --git a/imgui.cpp b/imgui.cpp index b8434f8..851da48 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -671,7 +671,8 @@ bool ScrollbarY; bool Visible; // Set to true on Begin() bool Accessed; // Set to true when any widget access the current window - bool Collapsed; + bool Collapsed; // Set when collapsing window to become only title-bar + bool SkipItems; // == Visible && !Collapsed int AutoFitFrames; ImGuiDrawContext DC; @@ -926,6 +927,7 @@ Visible = false; Accessed = false; Collapsed = false; + SkipItems = false; AutoFitFrames = -1; LastFrameDrawn = -1; ItemWidthDefault = 0.0f; @@ -1945,7 +1947,7 @@ // Apply and ImClamp scrolling window->ScrollY = window->NextScrollY; window->ScrollY = ImMax(window->ScrollY, 0.0f); - if (!window->Collapsed) + if (!window->Collapsed && !window->SkipItems) window->ScrollY = ImMin(window->ScrollY, ImMax(0.0f, (float)window->SizeContentsFit.y - window->SizeFull.y)); window->NextScrollY = window->ScrollY; @@ -2186,9 +2188,12 @@ if (window->Collapsed) window->Visible = false; } + if (g.Style.Alpha <= 0.0f) + window->Visible = false; - // Return collapsed so that user can perform an early out optimisation - return !window->Collapsed; + // Return false if we don't intend to display anything to allow user to perform an early out optimisation + window->SkipItems = !window->Visible || window->Collapsed; + return !window->SkipItems; } void End() @@ -2456,7 +2461,7 @@ void TextV(const char* fmt, va_list args) { ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; static char buf[1024]; @@ -2486,7 +2491,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; const char* text_begin = text; @@ -2584,7 +2589,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; // Declare a dummy item size to that upcoming items that are smaller will center-align on the newly expanded line height. @@ -2596,7 +2601,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; const ImGuiStyle& style = g.Style; const float w = window->DC.ItemWidth.back(); @@ -2669,7 +2674,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -2709,7 +2714,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -2827,7 +2832,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -2907,7 +2912,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; static char buf[1024]; @@ -3059,7 +3064,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -3295,7 +3300,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -3358,7 +3363,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; const ImGuiStyle& style = g.Style; @@ -3466,7 +3471,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; const ImGuiStyle& style = g.Style; @@ -3520,7 +3525,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -3709,7 +3714,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -3773,7 +3778,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiIO& io = g.IO; @@ -3997,7 +4002,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -4094,7 +4099,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -4209,7 +4214,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -4256,7 +4261,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; @@ -4392,7 +4397,7 @@ void Separator() { ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; if (window->DC.ColumnsCount > 1) @@ -4417,7 +4422,7 @@ void Spacing() { ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; ItemSize(ImVec2(0,0)); @@ -4427,7 +4432,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; const float line_height = ImMax(window->DC.CurrentLineHeight, size.y); @@ -4453,7 +4458,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; if (window->DC.ColumnsCount > 1) @@ -4507,7 +4512,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; float x, y; @@ -4580,7 +4585,7 @@ { ImGuiState& g = GImGui; ImGuiWindow* window = GetCurrentWindow(); - if (window->Collapsed) + if (window->SkipItems) return; if (window->DC.ColumnsCount != 1) @@ -4809,6 +4814,9 @@ void ImDrawList::AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris, const ImVec2& third_point_offset) { + if ((col >> 24) == 0) + return; + static ImVec2 circle_vtx[12]; static bool circle_vtx_builds = false; if (!circle_vtx_builds)