From e40c6c0a7c68b4d6a54dbd7613320f3351a03da2 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 14 Oct 2026 16:55:07 -0500 Subject: [PATCH] perf(market): clip off-screen rows in the portfolio editor The portfolio-editor address list drew every row every frame inside the fade-scroll child. It now runs through an ImGuiListClipper; the fixed step (the InvisibleButton height plus item spacing) keeps each row's cursor exactly where the unclipped loop put it, so the scroll extent for the fade shader, the check marks, the selection and the "selected rows float to the top" ordering are all unchanged. Verified on DX11 (Windows) at normal and large window sizes and at font scale 1.5, including skin switch and resize with the dialog open. Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/market_tab.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/windows/market_tab.cpp b/src/ui/windows/market_tab.cpp index 4683567..2197913 100644 --- a/src/ui/windows/market_tab.cpp +++ b/src/ui/windows/market_tab.cpp @@ -694,8 +694,14 @@ static void pfDrawAddressSection(App* app) float lw = ImGui::GetContentRegionAvail().x; if (filtered.empty()) Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), TR("portfolio_no_addr_match")); - for (const PfPick& pk : filtered) { - const AddressInfo& a = *pk.a; + // C181: clip the portfolio-editor rows. Fixed step = InvisibleButton height (rowH) + ItemSpacing.y, + // so each row's cursor (and the Layout density tokens that read the content region) is exactly where + // the unclipped loop put it; the scroll extent stays exact for the fade shader. + ImGuiListClipper rowClipper; + rowClipper.Begin(static_cast(filtered.size()), rowH + ImGui::GetStyle().ItemSpacing.y); + while (rowClipper.Step()) { + for (int ri = rowClipper.DisplayStart; ri < rowClipper.DisplayEnd; ++ri) { + const AddressInfo& a = *filtered[static_cast(ri)].a; bool inSet = selSet.count(a.address) != 0; ImVec2 rmn = ImGui::GetCursorScreenPos(); ImVec2 rmx(rmn.x + lw, rmn.y + rowH); @@ -750,6 +756,7 @@ static void pfDrawAddressSection(App* app) } ImGui::PopID(); } + } // while (rowClipper.Step()) material::EndFadeScrollChild(s_pfEdit.addrFade, ldl); }