load_image - add userdata handle

This commit is contained in:
twinaphex 2015-12-10 16:51:59 +01:00
parent 94248be657
commit 19f0a23e7e
5 changed files with 10 additions and 28 deletions

View File

@ -1020,15 +1020,9 @@ static void mui_context_destroy(void)
mui_context_bg_destroy(mui);
}
static bool mui_load_image(void *data, menu_image_type_t type)
static bool mui_load_image(void *userdata, void *data, menu_image_type_t type)
{
mui_handle_t *mui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu || !menu->userdata)
return false;
mui = (mui_handle_t*)menu->userdata;
mui_handle_t *mui = (mui_handle_t*)userdata;
switch (type)
{

View File

@ -2005,15 +2005,9 @@ static void xmb_context_bg_destroy(xmb_handle_t *xmb)
menu_display_texture_unload((uintptr_t*)&xmb->textures.bg.id);
}
static bool xmb_load_image(void *data, menu_image_type_t type)
static bool xmb_load_image(void *userdata, void *data, menu_image_type_t type)
{
xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return false;
xmb = (xmb_handle_t*)menu->userdata;
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
if (!xmb || !data)
return false;
@ -2040,8 +2034,6 @@ static bool xmb_load_image(void *data, menu_image_type_t type)
return true;
}
static void xmb_context_reset_textures(xmb_handle_t *xmb, const char *iconpath)
{
unsigned i;

View File

@ -1130,15 +1130,10 @@ static void zarch_context_destroy(void)
zarch_context_bg_destroy(zui);
}
static bool zarch_load_image(void *data, menu_image_type_t type)
static bool zarch_load_image(void *userdata,
void *data, menu_image_type_t type)
{
zui_t *zui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
if (!menu)
return false;
zui = (zui_t*)menu->userdata;
zui_t *zui = (zui_t*)userdata;
if (!zui || !data)
return false;

View File

@ -330,9 +330,10 @@ static void menu_driver_toggle(bool latch)
bool menu_driver_load_image(void *data, menu_image_type_t type)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (driver->load_image)
return driver->load_image(data, type);
return driver->load_image(menu->userdata, data, type);
return false;
}

View File

@ -282,7 +282,7 @@ typedef struct menu_ctx_driver
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,
uint32_t label_hash, uint32_t menu_label_hash);
bool (*load_image)(void *data, menu_image_type_t type);
bool (*load_image)(void *userdata, void *data, menu_image_type_t type);
const char *ident;
int (*environ_cb)(menu_environ_cb_t type, void *data, void *userdata);
int (*pointer_tap)(void *data, unsigned x, unsigned y, unsigned ptr,