Pass userdata pointer to render callback

This commit is contained in:
twinaphex 2015-12-10 14:45:34 +01:00
parent 2930997c25
commit f4695c7547
8 changed files with 13 additions and 40 deletions

View File

@ -401,12 +401,12 @@ end:
string_list_free(list); string_list_free(list);
} }
static void mui_render(void) static void mui_render(void *data)
{ {
float delta_time, dt; float delta_time, dt;
unsigned bottom, width, height, header_height; unsigned bottom, width, height, header_height;
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
mui_handle_t *mui = menu ? (mui_handle_t*)menu->userdata : NULL; mui_handle_t *mui = (mui_handle_t*)data;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
if (!mui) if (!mui)

View File

@ -360,7 +360,7 @@ int menu_iterate_render(void)
{ {
menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE_TIME, NULL); menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE_TIME, NULL);
if (driver->render) if (driver->render)
driver->render(); driver->render(menu->userdata);
} }
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL)) if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && !runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL))

View File

@ -405,7 +405,7 @@ static void rgui_blit_cursor(void)
color_rect(fb_data, fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF); color_rect(fb_data, fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF);
} }
static void rgui_render(void) static void rgui_render(void *data)
{ {
unsigned x, y; unsigned x, y;
bool display_kb, msg_force; bool display_kb, msg_force;
@ -417,9 +417,9 @@ static void rgui_render(void)
char title[256], title_buf[256], title_msg[64]; char title[256], title_buf[256], title_msg[64];
char msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH]; char msg[PATH_MAX_LENGTH], timedate[PATH_MAX_LENGTH];
uint16_t *fb_data = NULL; uint16_t *fb_data = NULL;
rgui_t *rgui = NULL;
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
rgui_t *rgui = (rgui_t*)data;
video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count); video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);
@ -429,11 +429,9 @@ static void rgui_render(void)
title_msg[0] = '\0'; title_msg[0] = '\0';
timedate[0] = '\0'; timedate[0] = '\0';
if (!menu || !menu->userdata) if (!menu || !rgui)
return; return;
rgui = (rgui_t*)menu->userdata;
if (!rgui->force_redraw) if (!rgui->force_redraw)
{ {
menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force); menu_display_ctl(MENU_DISPLAY_CTL_MSG_FORCE, &msg_force);

View File

@ -115,7 +115,7 @@ end:
string_list_free(list); string_list_free(list);
} }
static void rmenu_render(void) static void rmenu_render(void *data)
{ {
bool msg_force; bool msg_force;
uint64_t *frame_count; uint64_t *frame_count;

View File

@ -528,7 +528,7 @@ static void rmenu_xui_set_list_text(int index, const wchar_t* leftText,
} }
} }
static void rmenu_xui_render(void) static void rmenu_xui_render(void *data)
{ {
uint64_t *frame_count; uint64_t *frame_count;
bool display_kb, msg_force; bool display_kb, msg_force;

View File

@ -1561,19 +1561,13 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
menu_display_blend_end(); menu_display_blend_end();
} }
static void xmb_render(void) static void xmb_render(void *data)
{ {
float delta_time, dt; float delta_time, dt;
size_t selection; size_t selection;
unsigned i, end, height = 0; unsigned i, end, height = 0;
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data;
if (!menu)
return;
xmb = (xmb_handle_t*)menu->userdata;
if (!xmb) if (!xmb)
return; return;

View File

@ -886,25 +886,6 @@ static void zarch_zui_draw_cursor(float x, float y)
{ {
} }
static void zarch_render(void)
{
int bottom;
unsigned width, height;
zui_t *zarch = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu || !menu->userdata)
return;
(void)settings;
(void)bottom;
(void)zarch;
video_driver_get_size(&width, &height);
}
static int zarch_zui_render_pick_core(zui_t *zui) static int zarch_zui_render_pick_core(zui_t *zui)
{ {
static zui_tabbed_t tabbed = {~0U}; static zui_tabbed_t tabbed = {~0U};
@ -1324,7 +1305,7 @@ menu_ctx_driver_t menu_ctx_zarch = {
NULL, NULL,
NULL, NULL,
zarch_iterate, zarch_iterate,
zarch_render, NULL,
zarch_frame, zarch_frame,
zarch_init, zarch_init,
zarch_free, zarch_free,

View File

@ -253,7 +253,7 @@ typedef struct menu_ctx_driver
void (*set_texture)(void); void (*set_texture)(void);
void (*render_messagebox)(void *data, const char *msg); void (*render_messagebox)(void *data, const char *msg);
int (*iterate)(enum menu_action action); int (*iterate)(enum menu_action action);
void (*render)(void); void (*render)(void *data);
void (*frame)(void); void (*frame)(void);
void* (*init)(void); void* (*init)(void);
void (*free)(void*); void (*free)(void*);