perf(console): cull off-screen wrapped rows
A long wrapped console line could extend far past the viewport, yet every sub-row was still measured and drawn. - Sub-rows that fall entirely outside the clip rect are now skipped. The per-row ordinal still advances for a culled row, so scanline parity is unchanged. No visible change; only off-screen rows are skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1064,6 +1064,8 @@ void ConsoleTab::drawVisibleLines(float padX, float lineHeight, bool hasTextFilt
|
||||
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
ImU32 selColor = WithAlpha(Secondary(), 80);
|
||||
const float clipMinY = dl->GetClipRectMin().y;
|
||||
const float clipMaxY = dl->GetClipRectMax().y;
|
||||
|
||||
// A fold triangle clicked this frame; applied after the loop so we don't mutate the model
|
||||
// mid-draw. -1 = none.
|
||||
@@ -1165,6 +1167,15 @@ void ConsoleTab::drawVisibleLines(float padX, float lineHeight, bool hasTextFilt
|
||||
const char* segStart = line.text.c_str() + seg.byteStart;
|
||||
const char* segEnd = line.text.c_str() + seg.byteEnd;
|
||||
|
||||
// Row-granularity cull: a long wrapped line may extend far past the viewport, so skip
|
||||
// sub-rows entirely outside the clip rect. The ordinal still advances once per sub-row
|
||||
// (culled or not) so scanline parity is unchanged.
|
||||
const bool rowVisible = rowY + seg.height >= clipMinY && rowY <= clipMaxY;
|
||||
if (!rowVisible) {
|
||||
++scanRowOrdinal;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s_scanline_enabled && lineHeight > 0.0f) {
|
||||
scanline_rows_.push_back({rowY, rowY + seg.height, scanRowOrdinal});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user