From 264891de8d1002eb623bce7dbe95853805bd6cdd Mon Sep 17 00:00:00 2001 From: Jack Punter Date: Sun, 5 Jun 2022 18:34:23 +0100 Subject: [PATCH] Fix overdraw in large listers Fix bug where every element in a lister is drawn regardless of whether it is visible or not. This is a drastic performance improvements for large listers (Alt + J in Ryan's layer with large codebases for example) --- custom/4coder_lister_base.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom/4coder_lister_base.cpp b/custom/4coder_lister_base.cpp index 05c39b2b..c67a0361 100644 --- a/custom/4coder_lister_base.cpp +++ b/custom/4coder_lister_base.cpp @@ -295,6 +295,9 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){ i32 first_index = (i32)(scroll_y/block_height); y_pos += first_index*block_height; + i32 max_count = first_index + lister->visible_count + 3; + count = clamp_to(lister->filtered.count, max_count); + for (i32 i = first_index; i < count; i += 1){ Lister_Node *node = lister->filtered.node_ptrs[i];