(Menu) Create menu_display_font_init_first

This commit is contained in:
twinaphex 2015-04-24 22:01:33 +02:00
parent e2bea7ad9b
commit f2c0874521
4 changed files with 50 additions and 71 deletions

View File

@ -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);
}

View File

@ -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));

View File

@ -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);
}

View File

@ -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