mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
Merge pull request #1806 from heuripedes/master
Menu driver performance improvements
This commit is contained in:
commit
d3d4819ef9
@ -302,19 +302,25 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
|
||||
glui->list_block.carr.coords.vertices = 0;
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
for (i = menu->begin; i < end; i++)
|
||||
{
|
||||
bool entry_selected;
|
||||
char entry_path[PATH_MAX_LENGTH] = {0};
|
||||
char entry_value[PATH_MAX_LENGTH] = {0};
|
||||
char message[PATH_MAX_LENGTH] = {0};
|
||||
char entry_title_buf[PATH_MAX_LENGTH] = {0};
|
||||
char type_str_buf[PATH_MAX_LENGTH] = {0};
|
||||
char entry_path[PATH_MAX_LENGTH];
|
||||
char entry_value[PATH_MAX_LENGTH];
|
||||
char message[PATH_MAX_LENGTH];
|
||||
char entry_title_buf[PATH_MAX_LENGTH];
|
||||
char type_str_buf[PATH_MAX_LENGTH];
|
||||
int y = disp->header_height - menu->scroll_y + (glui->line_height * i);
|
||||
|
||||
if (y > height || ((y + (int)glui->line_height) < 0))
|
||||
continue;
|
||||
|
||||
entry_path[0] = '\0';
|
||||
entry_value[0] = '\0';
|
||||
message[0] = '\0';
|
||||
entry_title_buf[0] = '\0';
|
||||
type_str_buf[0] = '\0';
|
||||
|
||||
entry_selected = menu_entry_is_currently_selected(i);
|
||||
menu_entry_get_value(i, entry_value, sizeof(entry_value));
|
||||
menu_entry_get_path(i, entry_path, sizeof(entry_path));
|
||||
@ -337,10 +343,10 @@ static void glui_render_menu_list(glui_handle_t *glui,
|
||||
static void glui_frame(void)
|
||||
{
|
||||
unsigned width, height;
|
||||
char title[PATH_MAX_LENGTH] = {0};
|
||||
char title_buf[PATH_MAX_LENGTH] = {0};
|
||||
char title_msg[PATH_MAX_LENGTH] = {0};
|
||||
char timedate[PATH_MAX_LENGTH] = {0};
|
||||
char title[PATH_MAX_LENGTH];
|
||||
char title_buf[PATH_MAX_LENGTH];
|
||||
char title_msg[PATH_MAX_LENGTH];
|
||||
char timedate[PATH_MAX_LENGTH];
|
||||
gl_t *gl = NULL;
|
||||
glui_handle_t *glui = NULL;
|
||||
const struct font_renderer *font_driver = NULL;
|
||||
@ -377,6 +383,11 @@ static void glui_frame(void)
|
||||
)
|
||||
return;
|
||||
|
||||
title[0] = '\0';
|
||||
title_buf[0] = '\0';
|
||||
title_msg[0] = '\0';
|
||||
timedate[0] = '\0';
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
menu_display_set_viewport();
|
||||
@ -441,8 +452,9 @@ static void glui_frame(void)
|
||||
|
||||
if (menu_input->keyboard.display)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
const char *str = *menu_input->keyboard.buffer;
|
||||
msg[0] = '\0';
|
||||
|
||||
if (!str)
|
||||
str = "";
|
||||
@ -636,12 +648,36 @@ static float glui_get_scroll(void)
|
||||
static void glui_navigation_set(bool scroll)
|
||||
{
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
float scroll_pos = 0;
|
||||
|
||||
if (!menu || !disp || !scroll)
|
||||
return;
|
||||
|
||||
menu_animation_push(disp->animation, 10, glui_get_scroll(),
|
||||
scroll_pos = glui_get_scroll();
|
||||
|
||||
if (menu->userdata)
|
||||
{
|
||||
unsigned height = 0, num_lines = 0, end = 0;
|
||||
glui_handle_t *glui = (glui_handle_t*)menu->userdata;
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
|
||||
video_driver_get_size(NULL, &height);
|
||||
num_lines = height / glui->line_height;
|
||||
end = menu_entries_get_end();
|
||||
|
||||
if (nav->selection_ptr < num_lines / 2 || end <= num_lines)
|
||||
menu->begin = 0;
|
||||
else if (nav->selection_ptr < (end - num_lines / 2))
|
||||
menu->begin = nav->selection_ptr - num_lines / 2;
|
||||
else
|
||||
menu->begin = end - num_lines;
|
||||
|
||||
if (menu->begin > 5)
|
||||
menu->begin -= 5;
|
||||
}
|
||||
|
||||
menu_animation_push(disp->animation, 10, scroll_pos,
|
||||
&menu->scroll_y, EASING_IN_OUT_QUAD, NULL);
|
||||
}
|
||||
|
||||
|
@ -342,10 +342,10 @@ static void rgui_render(void)
|
||||
uint16_t hover_color, normal_color;
|
||||
size_t i, end;
|
||||
int bottom;
|
||||
char title[256] = {0};
|
||||
char title_buf[256] = {0};
|
||||
char title_msg[64] = {0};
|
||||
char timedate[PATH_MAX_LENGTH] = {0};
|
||||
char title[256];
|
||||
char title_buf[256];
|
||||
char title_msg[64];
|
||||
char timedate[PATH_MAX_LENGTH];
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
@ -357,6 +357,11 @@ static void rgui_render(void)
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
uint64_t frame_count = video_driver_get_frame_count();
|
||||
|
||||
title[0] = '\0';
|
||||
title_buf[0] = '\0';
|
||||
title_msg[0] = '\0';
|
||||
timedate[0] = '\0';
|
||||
|
||||
(void)driver;
|
||||
|
||||
if (!menu)
|
||||
@ -460,17 +465,23 @@ static void rgui_render(void)
|
||||
|
||||
for (; i < end; i++, y += FONT_HEIGHT_STRIDE)
|
||||
{
|
||||
char entry_path[PATH_MAX_LENGTH] = {0};
|
||||
char entry_value[PATH_MAX_LENGTH] = {0};
|
||||
char message[PATH_MAX_LENGTH] = {0};
|
||||
char entry_title_buf[PATH_MAX_LENGTH] = {0};
|
||||
char type_str_buf[PATH_MAX_LENGTH] = {0};
|
||||
char entry_path[PATH_MAX_LENGTH];
|
||||
char entry_value[PATH_MAX_LENGTH];
|
||||
char message[PATH_MAX_LENGTH];
|
||||
char entry_title_buf[PATH_MAX_LENGTH];
|
||||
char type_str_buf[PATH_MAX_LENGTH];
|
||||
unsigned entry_spacing = menu_entry_get_spacing(i);
|
||||
bool entry_selected = menu_entry_is_currently_selected(i);
|
||||
|
||||
if (i > (nav->selection_ptr + 100))
|
||||
continue;
|
||||
|
||||
entry_path[0] = '\0';
|
||||
entry_value[0] = '\0';
|
||||
message[0] = '\0';
|
||||
entry_title_buf[0] = '\0';
|
||||
type_str_buf[0] = '\0';
|
||||
|
||||
menu_entry_get_value(i, entry_value, sizeof(entry_value));
|
||||
menu_entry_get_path(i, entry_path, sizeof(entry_path));
|
||||
|
||||
|
@ -1028,7 +1028,12 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
matrix_4x4_scale(&mscal, 1 /* scale_factor */, 1 /* scale_factor */, 1);
|
||||
matrix_4x4_multiply(&mymat, &mscal, &mymat);
|
||||
|
||||
for (i = 0; i < end; i++)
|
||||
i = menu->begin;
|
||||
|
||||
if (list == xmb->selection_buf_old)
|
||||
i = 0;
|
||||
|
||||
for (; i < end; i++)
|
||||
{
|
||||
const float half_size = xmb->icon.size / 2.0f;
|
||||
char name[PATH_MAX_LENGTH];
|
||||
@ -1218,7 +1223,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y)
|
||||
|
||||
static void xmb_render(void)
|
||||
{
|
||||
unsigned i, current, end;
|
||||
unsigned i, current, end, height = 0;
|
||||
xmb_handle_t *xmb = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
@ -1238,32 +1243,42 @@ static void xmb_render(void)
|
||||
|
||||
menu_animation_update(disp->animation, disp->animation->delta_time / IDEAL_DT);
|
||||
|
||||
video_driver_get_size(NULL, &height);
|
||||
|
||||
current = nav->selection_ptr;
|
||||
end = menu_list_get_size(menu_list);
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
menu->begin = 0;
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
for (i = 0; i < end; i++)
|
||||
{
|
||||
float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
|
||||
float item_y1 = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
|
||||
float item_y2 = item_y1 + xmb->icon.size;
|
||||
|
||||
if (menu_input->pointer.y > item_y
|
||||
&& menu_input->pointer.y < item_y + xmb->icon.size)
|
||||
menu_input->pointer.ptr = i;
|
||||
if (item_y2 < 0)
|
||||
{
|
||||
menu->begin++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
for (i = 0; i < end; i++)
|
||||
if (item_y1 > height)
|
||||
continue;
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
{
|
||||
float item_y = xmb->margins.screen.top + xmb_item_y(xmb, i, current);
|
||||
if (menu_input->pointer.y > item_y1 && menu_input->pointer.y < item_y2)
|
||||
menu_input->pointer.ptr = i;
|
||||
}
|
||||
|
||||
if (menu_input->mouse.y > item_y && menu_input->mouse.y < item_y + xmb->icon.size)
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
if (menu_input->mouse.y > item_y1 && menu_input->mouse.y < item_y2)
|
||||
menu_input->mouse.ptr = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (menu->begin > 5)
|
||||
menu->begin -= 5;
|
||||
|
||||
anim->is_active = false;
|
||||
anim->label.is_updated = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user