Don't pass useless argument to set_texture().

Be more defensive in rmenu texture upload.
This commit is contained in:
Themaister 2014-06-01 00:20:54 +02:00
parent 206ea8012f
commit 79bd141839
4 changed files with 10 additions and 13 deletions

View File

@ -411,7 +411,7 @@ typedef struct menu_ctx_driver_backend
typedef struct menu_ctx_driver
{
void (*set_texture)(void*, bool);
void (*set_texture)(void*);
void (*render_messagebox)(const char*);
void (*render)(void);
void (*frame)(void);

View File

@ -1932,7 +1932,7 @@ static int menu_common_iterate(unsigned action)
file_list_get_last(driver.menu->menu_stack, &dir, &menu_type);
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->set_texture)
driver.menu_ctx->set_texture(driver.menu, false);
driver.menu_ctx->set_texture(driver.menu);
#ifdef HAVE_OSK
// process pending osk init callback

View File

@ -635,13 +635,13 @@ static int rgui_input_postprocess(uint64_t old_state)
return ret;
}
void rgui_set_texture(void *data, bool enable)
void rgui_set_texture(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable)
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_frame)
driver.video_poke->set_texture_frame(driver.video_data, menu_framebuf,
enable, rgui->width, rgui->height, 1.0f);
false, rgui->width, rgui->height, 1.0f);
}
static void rgui_init_core_info(void *data)

View File

@ -437,17 +437,17 @@ static void rmenu_render(void)
}
}
void rmenu_set_texture(void *data, bool enable)
void rmenu_set_texture(void *data)
{
rgui_handle_t *rgui = (rgui_handle_t*)data;
if (menu_texture_inited)
return;
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable)
if (driver.video_data && driver.video_poke && driver.video_poke->set_texture_enable && menu_texture && menu_texture->pixels)
{
driver.video_poke->set_texture_frame(driver.video_data, menu_texture->pixels,
enable, rgui->width, rgui->height, 1.0f);
true, rgui->width, rgui->height, 1.0f);
menu_texture_inited = true;
}
}
@ -459,13 +459,11 @@ static void rmenu_context_reset(void *data)
if (!rgui)
return;
menu_texture = (struct texture_image*)calloc(1, sizeof(*menu_texture));
texture_image_load(driver.video_data, g_extern.menu_texture_path, menu_texture);
rgui->width = menu_texture->width;
rgui->height = menu_texture->height;
rmenu_set_texture(rgui, true);
menu_texture_inited = false;
}
static void *rmenu_init(void)
@ -475,14 +473,13 @@ static void *rmenu_init(void)
if (!rgui)
return NULL;
menu_texture = (struct texture_image*)calloc(1, sizeof(*menu_texture));
return rgui;
}
static void rmenu_context_destroy(void *data)
{
texture_image_free(driver.video_data, menu_texture);
menu_texture_inited = false;
}
static void rmenu_free(void *data)