(RMenu Disp) Correctly frees and reinitializes RMenu texture asset
This commit is contained in:
parent
275789d99f
commit
2fab149ae4
|
@ -64,6 +64,7 @@
|
|||
|
||||
struct texture_image *menu_texture;
|
||||
static bool render_normal = true;
|
||||
static bool menu_texture_inited =false;
|
||||
|
||||
static void render_background(rgui_handle_t *rgui)
|
||||
{
|
||||
|
@ -383,17 +384,16 @@ static void rmenu_render(void *data)
|
|||
|
||||
void rmenu_set_texture(void *data, bool enable)
|
||||
{
|
||||
static bool inited =false;
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
|
||||
if (inited)
|
||||
if (menu_texture_inited)
|
||||
return;
|
||||
|
||||
if (driver.video_poke && driver.video_poke->set_texture_enable)
|
||||
{
|
||||
driver.video_poke->set_texture_frame(driver.video_data, menu_texture->pixels,
|
||||
enable, rgui->width, rgui->height, 1.0f);
|
||||
inited = true;
|
||||
menu_texture_inited = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,6 +437,7 @@ static void rmenu_free_assets(void *data)
|
|||
free(menu_texture->pixels);
|
||||
menu_texture->pixels = NULL;
|
||||
}
|
||||
menu_texture_inited = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1110,6 +1110,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
|||
}
|
||||
driver.video->restart();
|
||||
|
||||
if (menu_ctx && menu_ctx->free_assets)
|
||||
menu_ctx->free_assets(rgui);
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
|
@ -1128,6 +1130,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
|||
g_extern.lifecycle_state |= (1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||
|
||||
driver.video->restart();
|
||||
if (menu_ctx && menu_ctx->free_assets)
|
||||
menu_ctx->free_assets(rgui);
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
|
@ -1138,6 +1142,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
|||
g_extern.lifecycle_state &= ~(1ULL << MODE_VIDEO_PAL_TEMPORAL_ENABLE);
|
||||
|
||||
driver.video->restart();
|
||||
if (menu_ctx && menu_ctx->free_assets)
|
||||
menu_ctx->free_assets(rgui);
|
||||
if (menu_ctx && menu_ctx->init_assets)
|
||||
menu_ctx->init_assets(rgui);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue