mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Window: child windows outer decorations (e.g. scrollbar) are rendered as part of their parent window, avoiding the creation of an extraneous draw command.
+ Metrics: inverted color of clip rect vs vertices bounding box when hovering a draw command, so the color matches the per-vertex preview.
This commit is contained in:
parent
afa3978ff6
commit
0770449630
@ -35,6 +35,12 @@ HOW TO UPDATE?
|
||||
Breaking Changes:
|
||||
- IO: changed AddInputCharacter(unsigned short c) signature to AddInputCharacter(unsigned int c).
|
||||
- Renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
|
||||
- Window: rendering of child windows outer decorations (e.g. bg color, border, scrollbars) is now
|
||||
performed as part of their parent window, avoiding the creation of an extraneous draw commands.
|
||||
If you have overlapping child windows with decorations, and relied on their relative z-order to be
|
||||
mapped to submission their order, this will affect your rendering. The optimization is disabled
|
||||
if the parent window has no visual output because it appears to be the most common situation leading
|
||||
to the creation of overlapping child windows. Please reach out if you are affected by this change!
|
||||
|
||||
Other Changes:
|
||||
- Window: clarified behavior of SetNextWindowContentSize(). Content size is defined as the size available
|
||||
@ -44,8 +50,6 @@ Other Changes:
|
||||
- Window: Fixed auto-resize with AlwaysVerticalScrollbar or AlwaysHorizontalScrollbar flags.
|
||||
- Window: Fixed one case where auto-resize by double-clicking the resize grip would make either scrollbar
|
||||
appear for a single frame after the resize.
|
||||
- Columns: Fixed Separator from creating an extraneous draw command. (#125)
|
||||
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
|
||||
- Separator: Revert 1.70 "Declare its thickness (1.0f) to the layout" change. It's not incorrect
|
||||
but it breaks existing some layout patterns. Will return back to it when we expose Separator flags.
|
||||
- Fixed InputScalar, InputScalarN, SliderScalarN, DragScalarN with non-visible label from inserting
|
||||
@ -74,6 +78,8 @@ Other Changes:
|
||||
loop with the horizontal contents size.
|
||||
- Columns: Fixed Columns() within a window with horizontal scrolling from not covering the full
|
||||
horizontal area (previously only worked with an explicit contents size). (#125)
|
||||
- Columns: Fixed Separator from creating an extraneous draw command. (#125)
|
||||
- Columns: Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)
|
||||
- Style: Added style.WindowMenuButtonPosition (left/right, defaults to ImGuiDir_Left) to move the
|
||||
collapsing/docking button to the other side of the title bar.
|
||||
- Style: Made window close button cross slightly smaller.
|
||||
|
25
imgui.cpp
25
imgui.cpp
@ -369,6 +369,10 @@ CODE
|
||||
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2019/06/07 (1.71) - rendering of child window outer decorations (bg color, border, scrollbars) is now performed as part of the parent window. If you have
|
||||
overlapping child windows in a same parent, and relied on their relative z-order to be mapped to their submission order, this will affect your rendering.
|
||||
This optimization is disabled if the parent window has no visual output, because it appears to be the most common situation leading to the creation of overlapping child windows.
|
||||
Please reach out if you are affected.
|
||||
- 2019/05/13 (1.71) - renamed SetNextTreeNodeOpen() to SetNextItemOpen(). Kept inline redirection function (will obsolete).
|
||||
- 2019/05/11 (1.71) - changed io.AddInputCharacter(unsigned short c) signature to io.AddInputCharacter(unsigned int c).
|
||||
- 2019/04/29 (1.70) - improved ImDrawList thick strokes (>1.0f) preserving correct thickness up to 90 degrees angles (e.g. rectangles). If you have custom rendering using thick lines, they will appear thicker now.
|
||||
@ -3768,7 +3772,7 @@ static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, Im
|
||||
{
|
||||
int count = window->DC.ChildWindows.Size;
|
||||
if (count > 1)
|
||||
ImQsort(window->DC.ChildWindows.begin(), (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer);
|
||||
ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ImGuiWindow* child = window->DC.ChildWindows[i];
|
||||
@ -5603,10 +5607,25 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding);
|
||||
}
|
||||
|
||||
// Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.
|
||||
// When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
|
||||
// We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping child.
|
||||
// We also disabled this when we have dimming overlay behind this specific one child.
|
||||
// FIXME: More code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected.
|
||||
bool render_decorations_in_parent = false;
|
||||
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
|
||||
if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_window->DrawList->VtxBuffer.Size > 0)
|
||||
render_decorations_in_parent = true;
|
||||
if (render_decorations_in_parent)
|
||||
window->DrawList = parent_window->DrawList;
|
||||
|
||||
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
||||
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
||||
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
||||
|
||||
if (render_decorations_in_parent)
|
||||
window->DrawList = &window->DrawListInst;
|
||||
|
||||
// Draw navigation selection/windowing rectangle border
|
||||
if (g.NavWindowingTargetAnim == window)
|
||||
{
|
||||
@ -9883,8 +9902,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
ImRect vtxs_rect;
|
||||
for (int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++)
|
||||
vtxs_rect.Add(draw_list->VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);
|
||||
clip_rect.Floor(); fg_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255,255,0,255));
|
||||
vtxs_rect.Floor(); fg_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255,0,255,255));
|
||||
clip_rect.Floor(); fg_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255,0,255,255));
|
||||
vtxs_rect.Floor(); fg_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255,255,0,255));
|
||||
}
|
||||
if (!pcmd_node_open)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user