Expand font_driver_init_first

This commit is contained in:
twinaphex 2015-12-05 11:18:05 +01:00
parent 4c8a2a3f88
commit 5f27366cb3
5 changed files with 16 additions and 8 deletions

View File

@ -400,7 +400,8 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
strlcpy(settings->video.font_path, "game:\\media\\Arial_12.xpr",
sizeof(settings->video.font_path));
#endif
if (!font_driver_init_first(d3d, settings->video.font_path, 0, FONT_DRIVER_RENDER_DIRECT3D_API))
if (!font_driver_init_first(NULL, NULL,
d3d, settings->video.font_path, 0, FONT_DRIVER_RENDER_DIRECT3D_API))
{
RARCH_ERR("[D3D]: Failed to initialize font renderer.\n");
return false;

View File

@ -2641,7 +2641,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
if (settings->video.font_enable)
{
if (!font_driver_init_first(gl, *settings->video.font_path
if (!font_driver_init_first(NULL, NULL, gl, *settings->video.font_path
? settings->video.font_path : NULL, settings->video.font_size,
FONT_DRIVER_RENDER_OPENGL_API))
RARCH_ERR("[GL]: Failed to initialize font renderer.\n");

View File

@ -134,7 +134,7 @@ static void *vita2d_gfx_init(const video_info_t *video,
#ifdef HAVE_OVERLAY
vita->overlay_enable = false;
#endif
if (!font_driver_init_first(vita, *settings->video.font_path
if (!font_driver_init_first(NULL, NULL, vita, *settings->video.font_path
? settings->video.font_path : NULL, settings->video.font_size,
FONT_DRIVER_RENDER_VITA2D))
{

View File

@ -185,10 +185,16 @@ void font_driver_free(void *data)
driver->font_osd_driver = NULL;
}
bool font_driver_init_first(void *data, const char *font_path, float font_size,
bool font_driver_init_first(const void **font_driver, void *font_handle,
void *data, const char *font_path, float font_size,
enum font_driver_render_api api)
{
driver_t *driver = driver_get_ptr();
return font_init_first((const void**)&driver->font_osd_driver, &driver->font_osd_data,
data, font_path, font_size, api);
driver_t *driver = driver_get_ptr();
const void **new_font_driver = font_driver ? font_driver
: (const void**)&driver->font_osd_driver;
void *new_font_handle = font_handle ? font_handle
: &driver->font_osd_data;
return font_init_first(new_font_driver, new_font_handle,
data, font_path, font_size, api);
}

View File

@ -69,7 +69,8 @@ void font_driver_bind_block(void *block);
void font_driver_free(void *data);
bool font_driver_init_first(void *data, const char *font_path, float font_size,
bool font_driver_init_first(const void **font_driver, void *font_handle,
void *data, const char *font_path, float font_size,
enum font_driver_render_api api);
#ifdef __cplusplus