mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(menu) reduce calls to video_driver_get_size
This commit is contained in:
parent
00adc9a2d3
commit
24e0542bdb
@ -270,26 +270,28 @@ static void mui_draw_tab(mui_handle_t *mui,
|
||||
&tab_color[0]);
|
||||
}
|
||||
|
||||
static void mui_render_keyboard(mui_handle_t *mui, const char *grid[], unsigned id)
|
||||
static void mui_render_keyboard(mui_handle_t *mui,
|
||||
video_frame_info_t *video_info,
|
||||
const char *grid[], unsigned id)
|
||||
{
|
||||
int ptr_width, ptr_height;
|
||||
unsigned i, width, height;
|
||||
float dark[16]= {
|
||||
unsigned i;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
float dark[16] = {
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
};
|
||||
|
||||
float white[16]= {
|
||||
float white[16] = {
|
||||
1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00,
|
||||
};
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
menu_display_draw_quad(0, height/2.0, width, height/2.0,
|
||||
width, height,
|
||||
&dark[0]);
|
||||
@ -457,10 +459,13 @@ static void mui_get_message(void *data, const char *message)
|
||||
}
|
||||
|
||||
static void mui_render_messagebox(mui_handle_t *mui,
|
||||
video_frame_info_t *video_info,
|
||||
const char *message, float *body_bg_color, uint32_t font_color)
|
||||
{
|
||||
unsigned i, width, height, y_position;
|
||||
unsigned i, y_position;
|
||||
int x, y, line_height, longest = 0, longest_width = 0;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
struct string_list *list = (struct string_list*)
|
||||
string_split(message, "\n");
|
||||
|
||||
@ -469,8 +474,6 @@ static void mui_render_messagebox(mui_handle_t *mui,
|
||||
if (list->elems == 0)
|
||||
goto end;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
line_height = mui->font->size * 1.2;
|
||||
|
||||
y_position = height / 2;
|
||||
@ -515,7 +518,9 @@ static void mui_render_messagebox(mui_handle_t *mui,
|
||||
}
|
||||
|
||||
if (menu_input_dialog_get_display_kb())
|
||||
mui_render_keyboard(mui, menu_event_get_osk_grid(), menu_event_get_osk_ptr());
|
||||
mui_render_keyboard(mui,
|
||||
video_info,
|
||||
menu_event_get_osk_grid(), menu_event_get_osk_ptr());
|
||||
|
||||
end:
|
||||
string_list_free(list);
|
||||
@ -1405,13 +1410,13 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]);
|
||||
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
|
||||
mui_render_messagebox(mui, msg, &body_bg_color[0], font_hover_color);
|
||||
mui_render_messagebox(mui, video_info, msg, &body_bg_color[0], font_hover_color);
|
||||
}
|
||||
|
||||
if (!string_is_empty(mui->box_message))
|
||||
{
|
||||
menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]);
|
||||
mui_render_messagebox(mui, mui->box_message, &body_bg_color[0], font_hover_color);
|
||||
mui_render_messagebox(mui, video_info, mui->box_message, &body_bg_color[0], font_hover_color);
|
||||
mui->box_message[0] = '\0';
|
||||
}
|
||||
|
||||
|
@ -706,11 +706,15 @@ static void xmb_messagebox(void *data, const char *message)
|
||||
strlcpy(xmb->box_message, message, sizeof(xmb->box_message));
|
||||
}
|
||||
|
||||
static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned id)
|
||||
static void xmb_render_keyboard(xmb_handle_t *xmb,
|
||||
video_frame_info_t *video_info,
|
||||
const char *grid[], unsigned id)
|
||||
{
|
||||
unsigned i;
|
||||
int ptr_width, ptr_height;
|
||||
unsigned i, width, height;
|
||||
float dark[16]= {
|
||||
unsigned width = video_info->height;
|
||||
unsigned height = video_info->height;
|
||||
float dark[16] = {
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
@ -724,8 +728,6 @@ static void xmb_render_keyboard(xmb_handle_t *xmb, const char *grid[], unsigned
|
||||
1.00, 1.00, 1.00, 1.00,
|
||||
};
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
menu_display_draw_quad(0, height/2.0, width, height/2.0,
|
||||
width, height,
|
||||
&dark[0]);
|
||||
@ -798,19 +800,14 @@ static int xmb_osk_ptr_at_pos(void *data, int x, int y)
|
||||
|
||||
static void xmb_render_messagebox_internal(
|
||||
menu_display_frame_info_t menu_disp_info,
|
||||
video_frame_info_t *video_info,
|
||||
xmb_handle_t *xmb, const char *message)
|
||||
{
|
||||
int x, y, longest = 0, longest_width = 0;
|
||||
unsigned i, y_position;
|
||||
unsigned width, height;
|
||||
struct string_list *list = NULL;
|
||||
|
||||
if (!xmb)
|
||||
return;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
list = string_split(message, "\n");
|
||||
int x, y, longest = 0, longest_width = 0;
|
||||
unsigned width = video_info->width;
|
||||
unsigned height = video_info->height;
|
||||
struct string_list *list = string_split(message, "\n");
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -856,6 +853,7 @@ static void xmb_render_messagebox_internal(
|
||||
|
||||
if (menu_input_dialog_get_display_kb())
|
||||
xmb_render_keyboard(xmb,
|
||||
video_info,
|
||||
menu_event_get_osk_grid(),
|
||||
menu_event_get_osk_ptr());
|
||||
|
||||
@ -2887,7 +2885,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
xmb_draw_dark_layer(xmb, width, height);
|
||||
|
||||
xmb_render_messagebox_internal(menu_disp_info, xmb, msg);
|
||||
xmb_render_messagebox_internal(menu_disp_info, video_info, xmb, msg);
|
||||
}
|
||||
|
||||
/* Cursor image */
|
||||
|
Loading…
x
Reference in New Issue
Block a user