@@ -1601,7 +1601,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
1601
1601
// In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is
1602
1602
// always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
1603
1603
if ((table->Flags & ImGuiTableFlags_NoClip) == 0 )
1604
- window->DrawList ->_CmdHeader .ClipRect = table->BgClipRectForDrawCmd .ToVec4 ();
1604
+ window->DrawList ->_CmdHeader .ClipRect = table->Bg0ClipRectForDrawCmd .ToVec4 ();
1605
1605
table->DrawSplitter .SetCurrentChannel (window->DrawList , TABLE_DRAW_CHANNEL_BG0);
1606
1606
}
1607
1607
@@ -1657,10 +1657,10 @@ void ImGui::TableEndRow(ImGuiTable* table)
1657
1657
1658
1658
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
1659
1659
float y0 = ImMax (table->RowPosY2 + 1 , window->InnerClipRect .Min .y );
1660
- table->BgClipRect .Min .y = table->BgClipRectForDrawCmd .Min .y = ImMin (y0, window->InnerClipRect .Max .y );
1661
- table->BgClipRect .Max .y = table->BgClipRectForDrawCmd .Max .y = window->InnerClipRect .Max .y ;
1660
+ table->BgClipRect .Min .y = table->Bg2ClipRectForDrawCmd .Min .y = ImMin (y0, window->InnerClipRect .Max .y );
1661
+ table->BgClipRect .Max .y = table->Bg2ClipRectForDrawCmd .Max .y = window->InnerClipRect .Max .y ;
1662
1662
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen ;
1663
- IM_ASSERT (table->BgClipRectForDrawCmd .Min .y <= table->BgClipRectForDrawCmd .Max .y );
1663
+ IM_ASSERT (table->Bg2ClipRectForDrawCmd .Min .y <= table->Bg2ClipRectForDrawCmd .Max .y );
1664
1664
1665
1665
float row_height = table->RowPosY2 - table->RowPosY1 ;
1666
1666
table->RowPosY2 = window->DC .CursorPos .y = table->WorkRect .Min .y + table->RowPosY2 - table->OuterRect .Min .y ;
@@ -1669,7 +1669,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
1669
1669
{
1670
1670
ImGuiTableColumn* column = &table->Columns [column_n];
1671
1671
column->DrawChannelCurrent = column->DrawChannelUnfrozen ;
1672
- column->ClipRect .Min .y = table->BgClipRectForDrawCmd .Min .y ;
1672
+ column->ClipRect .Min .y = table->Bg2ClipRectForDrawCmd .Min .y ;
1673
1673
}
1674
1674
1675
1675
// Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
@@ -2019,7 +2019,7 @@ void ImGui::TablePushBackgroundChannel()
2019
2019
2020
2020
// Optimization: avoid SetCurrentChannel() + PushClipRect()
2021
2021
table->HostBackupInnerClipRect = window->ClipRect ;
2022
- SetWindowClipRectBeforeSetChannel (window, table->BgClipRectForDrawCmd );
2022
+ SetWindowClipRectBeforeSetChannel (window, table->Bg2ClipRectForDrawCmd );
2023
2023
table->DrawSplitter .SetCurrentChannel (window->DrawList , table->Bg2DrawChannelCurrent );
2024
2024
}
2025
2025
@@ -2046,7 +2046,7 @@ void ImGui::TablePopBackgroundChannel()
2046
2046
// - We allocate 1 or 2 background draw channels. This is because we know TablePushBackgroundChannel() is only used for
2047
2047
// horizontal spanning. If we allowed vertical spanning we'd need one background draw channel per merge group (1-4).
2048
2048
// Draw channel allocation (before merging):
2049
- // - NoClip --> 2+D+1 channels: bg0/1 + bg2 + foreground (same clip rect == 1 draw call) (FIXME-TABLE: could merge bg2 and foreground? )
2049
+ // - NoClip --> 2+D+1 channels: bg0/1 + bg2 + foreground (same clip rect == always 1 draw call)
2050
2050
// - Clip --> 2+D+N channels
2051
2051
// - FreezeRows --> 2+D+N*2 (unless scrolling value is zero)
2052
2052
// - FreezeRows || FreezeColunns --> 3+D+N*2 (unless scrolling value is zero)
@@ -2085,7 +2085,8 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table)
2085
2085
// All our cell highlight are manually clipped with BgClipRect. When unfreezing it will be made smaller to fit scrolling rect.
2086
2086
// (This technically isn't part of setting up draw channels, but is reasonably related to be done here)
2087
2087
table->BgClipRect = table->InnerClipRect ;
2088
- table->BgClipRectForDrawCmd = table->HostClipRect ;
2088
+ table->Bg0ClipRectForDrawCmd = table->OuterWindow ->ClipRect ;
2089
+ table->Bg2ClipRectForDrawCmd = table->HostClipRect ;
2089
2090
IM_ASSERT (table->BgClipRect .Min .y <= table->BgClipRect .Max .y );
2090
2091
}
2091
2092
@@ -2288,19 +2289,17 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table)
2288
2289
void ImGui::TableDrawBorders (ImGuiTable* table)
2289
2290
{
2290
2291
ImGuiWindow* inner_window = table->InnerWindow ;
2291
- ImGuiWindow* outer_window = table->OuterWindow ;
2292
2292
table->DrawSplitter .SetCurrentChannel (inner_window->DrawList , TABLE_DRAW_CHANNEL_BG0);
2293
2293
if (inner_window->Hidden || !table->HostClipRect .Overlaps (table->InnerClipRect ))
2294
2294
return ;
2295
2295
ImDrawList* inner_drawlist = inner_window->DrawList ;
2296
- ImDrawList* outer_drawlist = outer_window-> DrawList ;
2296
+ inner_drawlist-> PushClipRect (table-> Bg0ClipRectForDrawCmd . Min , table-> Bg0ClipRectForDrawCmd . Max , false ) ;
2297
2297
2298
2298
// Draw inner border and resizing feedback
2299
2299
const float border_size = TABLE_BORDER_SIZE;
2300
2300
const float draw_y1 = table->InnerRect .Min .y ;
2301
2301
const float draw_y2_body = table->InnerRect .Max .y ;
2302
2302
const float draw_y2_head = table->IsUsingHeaders ? ((table->FreezeRowsCount >= 1 ? table->OuterRect .Min .y : table->WorkRect .Min .y ) + table->LastFirstRowHeight ) : draw_y1;
2303
-
2304
2303
if (table->Flags & ImGuiTableFlags_BordersInnerV)
2305
2304
{
2306
2305
for (int order_n = 0 ; order_n < table->ColumnsCount ; order_n++)
@@ -2351,23 +2350,21 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
2351
2350
// parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part
2352
2351
// of it in inner window, and the part that's over scrollbars in the outer window..)
2353
2352
// Either solution currently won't allow us to use a larger border size: the border would clipped.
2354
- ImRect outer_border = table->OuterRect ;
2353
+ const ImRect outer_border = table->OuterRect ;
2355
2354
const ImU32 outer_col = table->BorderColorStrong ;
2356
- if (inner_window != outer_window) // FIXME-TABLE
2357
- outer_border.Expand (1 .0f );
2358
2355
if ((table->Flags & ImGuiTableFlags_BordersOuter) == ImGuiTableFlags_BordersOuter)
2359
2356
{
2360
- outer_drawlist ->AddRect (outer_border.Min , outer_border.Max , outer_col, 0 .0f , ~0 , border_size);
2357
+ inner_drawlist ->AddRect (outer_border.Min , outer_border.Max , outer_col, 0 .0f , ~0 , border_size);
2361
2358
}
2362
2359
else if (table->Flags & ImGuiTableFlags_BordersOuterV)
2363
2360
{
2364
- outer_drawlist ->AddLine (outer_border.Min , ImVec2 (outer_border.Min .x , outer_border.Max .y ), outer_col, border_size);
2365
- outer_drawlist ->AddLine (ImVec2 (outer_border.Max .x , outer_border.Min .y ), outer_border.Max , outer_col, border_size);
2361
+ inner_drawlist ->AddLine (outer_border.Min , ImVec2 (outer_border.Min .x , outer_border.Max .y ), outer_col, border_size);
2362
+ inner_drawlist ->AddLine (ImVec2 (outer_border.Max .x , outer_border.Min .y ), outer_border.Max , outer_col, border_size);
2366
2363
}
2367
2364
else if (table->Flags & ImGuiTableFlags_BordersOuterH)
2368
2365
{
2369
- outer_drawlist ->AddLine (outer_border.Min , ImVec2 (outer_border.Max .x , outer_border.Min .y ), outer_col, border_size);
2370
- outer_drawlist ->AddLine (ImVec2 (outer_border.Min .x , outer_border.Max .y ), outer_border.Max , outer_col, border_size);
2366
+ inner_drawlist ->AddLine (outer_border.Min , ImVec2 (outer_border.Max .x , outer_border.Min .y ), outer_col, border_size);
2367
+ inner_drawlist ->AddLine (ImVec2 (outer_border.Min .x , outer_border.Max .y ), outer_border.Max , outer_col, border_size);
2371
2368
}
2372
2369
}
2373
2370
if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect .Max .y )
@@ -2377,6 +2374,8 @@ void ImGui::TableDrawBorders(ImGuiTable* table)
2377
2374
if (border_y >= table->BgClipRect .Min .y && border_y < table->BgClipRect .Max .y )
2378
2375
inner_drawlist->AddLine (ImVec2 (table->BorderX1 , border_y), ImVec2 (table->BorderX2 , border_y), table->BorderColorLight , border_size);
2379
2376
}
2377
+
2378
+ inner_drawlist->PopClipRect ();
2380
2379
}
2381
2380
2382
2381
// -------------------------------------------------------------------------
@@ -2638,7 +2637,6 @@ void ImGui::TableHeadersRow()
2638
2637
// Emit a column header (text + optional sort order)
2639
2638
// We cpu-clip text here so that all columns headers can be merged into a same draw call.
2640
2639
// Note that because of how we cpu-clip and display sorting indicators, you _cannot_ use SameLine() after a TableHeader()
2641
- // FIXME-TABLE: Style confusion between CellPadding.y and FramePadding.y
2642
2640
void ImGui::TableHeader (const char * label)
2643
2641
{
2644
2642
ImGuiContext& g = *GImGui;
@@ -2660,7 +2658,7 @@ void ImGui::TableHeader(const char* label)
2660
2658
ImVec2 label_pos = window->DC .CursorPos ;
2661
2659
2662
2660
// If we already got a row height, there's use that.
2663
- // FIXME-TABLE-PADDING: Problem if the correct outer-padding CellBgRect strays off our ClipRect
2661
+ // FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect?
2664
2662
ImRect cell_r = TableGetCellBgRect (table, column_n);
2665
2663
float label_height = ImMax (label_size.y , table->RowMinHeight - table->CellPaddingY * 2 .0f );
2666
2664
@@ -2671,7 +2669,7 @@ void ImGui::TableHeader(const char* label)
2671
2669
const float ARROW_SCALE = 0 .65f ;
2672
2670
if ((table->Flags & ImGuiTableFlags_Sortable) && !(column->Flags & ImGuiTableColumnFlags_NoSort))
2673
2671
{
2674
- w_arrow = ImFloor (g.FontSize * ARROW_SCALE + g.Style .FramePadding .x );// table->CellPadding.x);
2672
+ w_arrow = ImFloor (g.FontSize * ARROW_SCALE + g.Style .FramePadding .x );
2675
2673
if (column->SortOrder > 0 )
2676
2674
{
2677
2675
ImFormatString (sort_order_suf, IM_ARRAYSIZE (sort_order_suf), " %d" , column->SortOrder + 1 );
0 commit comments