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)
This commit is contained in:
Jack Punter 2022-06-05 18:34:23 +01:00
parent 20588ab236
commit 264891de8d
1 changed files with 3 additions and 0 deletions

View File

@ -295,6 +295,9 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
i32 first_index = (i32)(scroll_y/block_height); i32 first_index = (i32)(scroll_y/block_height);
y_pos += first_index*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){ for (i32 i = first_index; i < count; i += 1){
Lister_Node *node = lister->filtered.node_ptrs[i]; Lister_Node *node = lister->filtered.node_ptrs[i];