Library: fewer temporaries per window, child, input field, separator text and resizable table: Begin() skips CalcWindowAutoFitSize() when no axis auto-fits (result unused; still called when a size callback would see it), scalar scrollbar/auto-fit/avail/needed sizes, ScrollbarSizes updated in place, scratch viewport/visibility rects, OuterRectClipped and the previous-child overlap test without ImRects; RenderWindowOuterBorders() scratch corner; EndChild() scratch size/bb; InputTextEx() scalar label/frame/inner sizes, scratch total_bb and (single-line, until ItemAdd() accepts it) frame_bb, so clipped fields allocate nothing; SeparatorTextEx() scratch sizes/rect/positions; TableUpdateBorders() scratch hit rect
demo_all scene headless: 825 -> 553 KB/frame allocated (Begin 5.3 -> 1.4 KB per window, InputTextEx 0.8 KB -> 0 per clipped field), user instructions/frame -1.3%. GC steps in that scene cost ~+1.5 ms on 2-4 frames per cycle, so cycles get ~1/3 rarer. Draw data unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c035841840
commit
a279fa1152
3 files changed
+97
-51
No files matched your search
+4
-1
@@ -1567,6 +1567,8 @@ function ImGui.TableApplyExternalUnclipRect(table_, rect)
|
||||
end
|
||||
end
|
||||
|
||||
local TableUpdateBorders_hit_rect = ImRect()
|
||||
|
||||
-- Process hit-testing on resizing borders. Actual size change will be applied in EndTable()
|
||||
-- - Set table.HoveredColumnBorder with a short delay/timer to reduce visual feedback noise.
|
||||
function ImGui.TableUpdateBorders(table_)
|
||||
@@ -1606,7 +1608,8 @@ function ImGui.TableUpdateBorders(table_)
|
||||
end
|
||||
|
||||
local column_id = ImGui.TableGetColumnResizeID(table_, column_n, table_.InstanceCurrent)
|
||||
local hit_rect = ImRect(column.MaxX - hit_half_width, hit_y1, column.MaxX + hit_half_width, border_y2_hit)
|
||||
local hit_rect = TableUpdateBorders_hit_rect -- [Luau] scratch: ItemAdd() copies it, ButtonBehavior() reads it
|
||||
hit_rect.Min.x = column.MaxX - hit_half_width; hit_rect.Min.y = hit_y1; hit_rect.Max.x = column.MaxX + hit_half_width; hit_rect.Max.y = border_y2_hit
|
||||
ImGui.ItemAdd(hit_rect, column_id, nil, ImGuiItemFlags.NoNav)
|
||||
--ImGui.GetForegroundDrawList():AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100))
|
||||
|
||||
|
||||
Reference in new issue
Block a user