(Menu) Cleanups

This commit is contained in:
twinaphex 2015-06-15 17:24:07 +02:00
parent 0a45da5080
commit 9b8248d3d2
3 changed files with 21 additions and 19 deletions

View File

@ -134,9 +134,8 @@ bool menu_load_content(void)
void menu_common_load_content(bool persist)
{
menu_display_t *disp = menu_display_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu || !menu_list)
if (!menu_list)
return;
event_command(persist ? EVENT_CMD_LOAD_CONTENT_PERSIST : EVENT_CMD_LOAD_CONTENT);

View File

@ -58,9 +58,8 @@ void menu_cbs_init(void *data,
uint32_t label_hash = 0;
uint32_t menu_label_hash = 0;
file_list_t *list = (file_list_t*)data;
menu_handle_t *menu = menu_driver_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
if (!menu || !menu_list || !list)
if (!menu_list || !list)
return;
cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(list, idx);

View File

@ -202,11 +202,11 @@ bool menu_display_font_init_first(const void **font_driver,
bool menu_display_font_bind_block(void *data,
const struct font_renderer *font_driver, void *userdata)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!font_driver || !font_driver->bind_block)
menu_display_t *disp = menu_display_get_ptr();
if (!disp || !font_driver || !font_driver->bind_block)
return false;
font_driver->bind_block(menu->display.font.buf, userdata);
font_driver->bind_block(disp->font.buf, userdata);
return true;
}
@ -226,13 +226,13 @@ bool menu_display_font_flush_block(void *data,
void menu_display_free_main_font(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
driver_t *driver = driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr();
if (menu->display.font.buf)
if (disp && disp->font.buf)
{
driver->font_osd_driver->free(menu->display.font.buf);
menu->display.font.buf = NULL;
driver->font_osd_driver->free(disp->font.buf);
disp->font.buf = NULL;
}
}
@ -243,18 +243,22 @@ bool menu_display_init_main_font(void *data,
menu_handle_t *menu = (menu_handle_t*)data;
driver_t *driver = driver_get_ptr();
void *video = video_driver_get_ptr(NULL);
menu_display_t *disp = menu ? &menu->display : NULL;
if (menu->display.font.buf)
if (!disp)
return false;
if (disp->font.buf)
menu_display_free_main_font(menu);
ret = menu_display_font_init_first(
(const void**)&driver->font_osd_driver, &menu->display.font.buf, video,
(const void**)&driver->font_osd_driver, &disp->font.buf, video,
font_path, font_size);
if (ret)
menu->display.font.size = font_size;
disp->font.size = font_size;
else
menu->display.font.buf = NULL;
disp->font.buf = NULL;
return ret;
}