Refactoring: View2DScrollers memory allocation

View2DScrollers used the memory manager to allocate memory. This isn't a
problem but in a upcoming change the scrollers will be drawn more often
than it used to (See {D8066}). To limit the number of allocations and
frees this patch will use the stack for allocation.

Reviewed By: Campbell Barton

Differential Revision: https://developer.blender.org/D8076
This commit is contained in:
Jeroen Bakker
2020-06-22 21:44:18 +02:00
committed by Jeroen Bakker
parent 9335daac2a
commit 2fdca5bd19
17 changed files with 63 additions and 112 deletions

View File

@@ -449,7 +449,6 @@ static void file_main_region_draw(const bContext *C, ARegion *region)
FileSelectParams *params = ED_fileselect_get_params(sfile);
View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
float col[3];
/* Needed, because filelist is not initialized on loading */
@@ -509,9 +508,7 @@ static void file_main_region_draw(const bContext *C, ARegion *region)
/* scrollers */
rcti view_rect;
ED_fileselect_layout_maskrect(sfile->layout, v2d, &view_rect);
scrollers = UI_view2d_scrollers_calc(v2d, &view_rect);
UI_view2d_scrollers_draw(v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
UI_view2d_scrollers_draw(v2d, &view_rect);
}
static void file_operatortypes(void)