UI: Perf: Add BLF batching for File browser and UI blocks.

This batch together most of the calls that can be batch together.
This commit is contained in:
Clément Foucault 2018-03-30 21:09:24 +02:00
parent 963e48e1df
commit f44d3e83cc
2 changed files with 10 additions and 0 deletions

View File

@ -1426,6 +1426,8 @@ void UI_block_draw(const bContext *C, uiBlock *block)
else if (block->panel)
ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar));
BLF_batching_start();
/* widgets */
for (but = block->buttons.first; but; but = but->next) {
if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
@ -1437,6 +1439,8 @@ void UI_block_draw(const bContext *C, uiBlock *block)
ui_draw_but(C, ar, &style, but, &rect);
}
}
BLF_batching_end();
/* restore matrix */
gpuPopProjectionMatrix();

View File

@ -52,6 +52,8 @@
#include "BLT_translation.h"
#include "BLF_api.h"
#include "IMB_imbuf_types.h"
#include "DNA_userdef_types.h"
@ -607,6 +609,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
}
BLF_batching_start();
for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
unsigned int file_selflag;
char path[FILE_MAX_LIBEXTRA];
@ -736,6 +740,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
}
BLF_batching_end();
UI_block_end(C, block);
UI_block_draw(C, block);