diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index c1a830e882..aa8cc3f67d 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -769,40 +769,6 @@ static void glui_populate_entries(const char *path, menu->scroll_y = glui_get_scroll(); } -static bool glui_font_init_first(const void **font_driver, - void **font_handle, void *video_data, const char *font_path, - float font_size) -{ - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); - - if (settings->video.threaded - && !global->system.hw_render_callback.context_type) - { - driver_t *driver = driver_get_ptr(); - thread_video_t *thr = driver ? (thread_video_t*)driver->video_data : NULL; - - if (!thr) - return false; - - thr->cmd_data.font_init.method = font_init_first; - thr->cmd_data.font_init.font_driver = (const void**)font_driver; - thr->cmd_data.font_init.font_handle = font_handle; - thr->cmd_data.font_init.video_data = video_data; - thr->cmd_data.font_init.font_path = font_path; - thr->cmd_data.font_init.font_size = font_size; - thr->cmd_data.font_init.api = FONT_DRIVER_RENDER_OPENGL_API; - - thr->send_cmd_func(thr, CMD_FONT_INIT); - thr->wait_reply_func(thr, CMD_FONT_INIT); - - return thr->cmd_data.font_init.return_value; - } - - return font_init_first(font_driver, font_handle, video_data, - font_path, font_size, FONT_DRIVER_RENDER_OPENGL_API); -} - static void glui_context_reset(void) { gl_t *gl = NULL; @@ -810,6 +776,8 @@ static void glui_context_reset(void) const font_renderer_driver_t *font_drv = NULL; menu_handle_t *menu = menu_driver_get_ptr(); + (void)font_drv; + if (!menu) return; @@ -824,9 +792,10 @@ static void glui_context_reset(void) font_drv = (const font_renderer_driver_t *)gl->font_driver; - glui_font_init_first(&gl->font_driver, + menu_display_font_init_first( + &gl->font_driver, &glui->font.buf, - gl, + gl, NULL, glui->font.size); } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1bc4826723..47976db4da 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1610,40 +1610,6 @@ static void xmb_free(void *data) font_driver->bind_block(gl->font_handle, NULL); } -static bool xmb_font_init_first(const void **font_driver, - void **font_handle, void *video_data, const char *font_path, - float xmb_font_size) -{ - settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); - - if (settings->video.threaded - && !global->system.hw_render_callback.context_type) - { - driver_t *driver = driver_get_ptr(); - thread_video_t *thr = (thread_video_t*)driver->video_data; - - if (!thr) - return false; - - thr->cmd_data.font_init.method = font_init_first; - thr->cmd_data.font_init.font_driver = (const void**)font_driver; - thr->cmd_data.font_init.font_handle = font_handle; - thr->cmd_data.font_init.video_data = video_data; - thr->cmd_data.font_init.font_path = font_path; - thr->cmd_data.font_init.font_size = xmb_font_size; - thr->cmd_data.font_init.api = FONT_DRIVER_RENDER_OPENGL_API; - - thr->send_cmd_func(thr, CMD_FONT_INIT); - thr->wait_reply_func(thr, CMD_FONT_INIT); - - return thr->cmd_data.font_init.return_value; - } - - return font_init_first(font_driver, font_handle, video_data, - font_path, xmb_font_size, FONT_DRIVER_RENDER_OPENGL_API); -} - static bool xmb_load_wallpaper(void *data) { xmb_handle_t *xmb = NULL; @@ -1711,7 +1677,12 @@ static void xmb_context_reset(void) fill_pathname_join(fontpath, themepath, "font.ttf", sizeof(fontpath)); - xmb_font_init_first(&gl->font_driver, &xmb->font.buf, gl, fontpath, xmb->font.size); + menu_display_font_init_first( + &gl->font_driver, + &xmb->font.buf, + gl, + fontpath, + xmb->font.size); fill_pathname_join(xmb->textures.list[XMB_TEXTURE_SETTINGS].path, iconpath, "settings.png", sizeof(xmb->textures.list[XMB_TEXTURE_SETTINGS].path)); diff --git a/menu/menu_display.c b/menu/menu_display.c index c25650a3e8..941034da9c 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -98,3 +98,37 @@ float menu_display_get_dpi(menu_handle_t *menu) return dpi; } + +bool menu_display_font_init_first(const void **font_driver, + void **font_handle, void *video_data, const char *font_path, + float font_size) +{ + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + + if (settings->video.threaded + && !global->system.hw_render_callback.context_type) + { + driver_t *driver = driver_get_ptr(); + thread_video_t *thr = (thread_video_t*)driver->video_data; + + if (!thr) + return false; + + thr->cmd_data.font_init.method = font_init_first; + thr->cmd_data.font_init.font_driver = (const void**)font_driver; + thr->cmd_data.font_init.font_handle = font_handle; + thr->cmd_data.font_init.video_data = video_data; + thr->cmd_data.font_init.font_path = font_path; + thr->cmd_data.font_init.font_size = font_size; + thr->cmd_data.font_init.api = FONT_DRIVER_RENDER_OPENGL_API; + + thr->send_cmd_func(thr, CMD_FONT_INIT); + thr->wait_reply_func(thr, CMD_FONT_INIT); + + return thr->cmd_data.font_init.return_value; + } + + return font_init_first(font_driver, font_handle, video_data, + font_path, font_size, FONT_DRIVER_RENDER_OPENGL_API); +} diff --git a/menu/menu_display.h b/menu/menu_display.h index 3465c4012d..63ec94ae22 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -17,6 +17,7 @@ #define __MENU_DISPLAY_H__ #include "menu_driver.h" +#include "../gfx/video_thread_wrapper.h" #ifdef __cplusplus extern "C" { @@ -32,6 +33,10 @@ bool menu_display_update_pending(void); float menu_display_get_dpi(menu_handle_t *menu); +bool menu_display_font_init_first(const void **font_driver, + void **font_handle, void *video_data, const char *font_path, + float font_size); + #ifdef __cplusplus } #endif