mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Replace gl_font_init_first and d3d_font_init_first with common function
This commit is contained in:
parent
1a390b8779
commit
bd63de9b3a
@ -2419,9 +2419,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
|
|
||||||
if (settings->video.font_enable)
|
if (settings->video.font_enable)
|
||||||
{
|
{
|
||||||
if (!gl_font_init_first(&gl->font_driver, &gl->font_handle,
|
if (!font_init_first(&gl->font_driver, &gl->font_handle,
|
||||||
gl, *settings->video.font_path
|
gl, *settings->video.font_path
|
||||||
? settings->video.font_path : NULL, settings->video.font_size))
|
? settings->video.font_path : NULL, settings->video.font_size,
|
||||||
|
FONT_DRIVER_RENDER_OPENGL_API))
|
||||||
RARCH_ERR("[GL]: Failed to initialize font renderer.\n");
|
RARCH_ERR("[GL]: Failed to initialize font renderer.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ static const font_renderer_t *d3d_font_backends[] = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
bool d3d_font_init_first(
|
static bool d3d_font_init_first(
|
||||||
const void **font_driver, void **font_handle,
|
const void **font_driver, void **font_handle,
|
||||||
void *video_data, const char *font_path, float font_size)
|
void *video_data, const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
@ -62,7 +62,8 @@ static const font_renderer_t *gl_font_backends[] = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool gl_font_init_first(const void **font_driver, void **font_handle,
|
static bool gl_font_init_first(
|
||||||
|
const void **font_driver, void **font_handle,
|
||||||
void *video_data, const char *font_path, float font_size)
|
void *video_data, const char *font_path, float font_size)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -82,3 +83,29 @@ bool gl_font_init_first(const void **font_driver, void **font_handle,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool font_init_first(const void **font_driver, void **font_handle,
|
||||||
|
void *video_data, const char *font_path, float font_size,
|
||||||
|
enum font_driver_render_api api)
|
||||||
|
{
|
||||||
|
switch (api)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_D3D
|
||||||
|
case FONT_DRIVER_RENDER_DIRECT3D_API:
|
||||||
|
return d3d_font_init_first(font_driver, font_handle,
|
||||||
|
video_data, font_path, font_size);
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
case FONT_DRIVER_RENDER_OPENGL_API:
|
||||||
|
return gl_font_init_first(font_driver, font_handle,
|
||||||
|
video_data, font_path, font_size);
|
||||||
|
#endif
|
||||||
|
case FONT_DRIVER_RENDER_DONT_CARE:
|
||||||
|
/* TODO/FIXME - lookup graphics driver's 'API' */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -25,17 +25,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_D3D
|
enum font_driver_render_api
|
||||||
bool d3d_font_init_first(
|
{
|
||||||
const void **font_driver, void **font_handle,
|
FONT_DRIVER_RENDER_DONT_CARE,
|
||||||
void *video_data, const char *font_path, float font_size);
|
FONT_DRIVER_RENDER_OPENGL_API,
|
||||||
#endif
|
FONT_DRIVER_RENDER_DIRECT3D_API,
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
bool font_init_first(
|
||||||
bool gl_font_init_first(const void **font_driver,
|
const void **font_driver, void **font_handle,
|
||||||
void **font_handle, void *gl_data,
|
void *video_data, const char *font_path, float font_size,
|
||||||
const char *font_path, float font_size);
|
enum font_driver_render_api api);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,8 @@ static void thread_loop(void *data)
|
|||||||
thr->cmd_data.font_init.font_handle,
|
thr->cmd_data.font_init.font_handle,
|
||||||
thr->cmd_data.font_init.video_data,
|
thr->cmd_data.font_init.video_data,
|
||||||
thr->cmd_data.font_init.font_path,
|
thr->cmd_data.font_init.font_path,
|
||||||
thr->cmd_data.font_init.font_size);
|
thr->cmd_data.font_init.font_size,
|
||||||
|
thr->cmd_data.font_init.api);
|
||||||
thread_reply(thr, CMD_FONT_INIT);
|
thread_reply(thr, CMD_FONT_INIT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <rthreads/rthreads.h>
|
#include <rthreads/rthreads.h>
|
||||||
|
#include "font_driver.h"
|
||||||
|
|
||||||
enum thread_cmd
|
enum thread_cmd
|
||||||
{
|
{
|
||||||
@ -173,13 +174,14 @@ typedef struct thread_video
|
|||||||
{
|
{
|
||||||
bool (*method)(const void **font_driver,
|
bool (*method)(const void **font_driver,
|
||||||
void **font_handle, void *video_data, const char *font_path,
|
void **font_handle, void *video_data, const char *font_path,
|
||||||
float font_size);
|
float font_size, enum font_driver_render_api api);
|
||||||
const void **font_driver;
|
const void **font_driver;
|
||||||
void **font_handle;
|
void **font_handle;
|
||||||
void *video_data;
|
void *video_data;
|
||||||
const char *font_path;
|
const char *font_path;
|
||||||
float font_size;
|
float font_size;
|
||||||
bool return_value;
|
bool return_value;
|
||||||
|
enum font_driver_render_api api;
|
||||||
} font_init;
|
} font_init;
|
||||||
|
|
||||||
} cmd_data;
|
} cmd_data;
|
||||||
|
@ -785,20 +785,22 @@ static bool glui_font_init_first(const void **font_driver,
|
|||||||
if (!thr)
|
if (!thr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
thr->cmd_data.font_init.method = gl_font_init_first;
|
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_driver = (const void**)font_driver;
|
||||||
thr->cmd_data.font_init.font_handle = font_handle;
|
thr->cmd_data.font_init.font_handle = font_handle;
|
||||||
thr->cmd_data.font_init.video_data = video_data;
|
thr->cmd_data.font_init.video_data = video_data;
|
||||||
thr->cmd_data.font_init.font_path = font_path;
|
thr->cmd_data.font_init.font_path = font_path;
|
||||||
thr->cmd_data.font_init.font_size = font_size;
|
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->send_cmd_func(thr, CMD_FONT_INIT);
|
||||||
thr->wait_reply_func(thr, CMD_FONT_INIT);
|
thr->wait_reply_func(thr, CMD_FONT_INIT);
|
||||||
|
|
||||||
return thr->cmd_data.font_init.return_value;
|
return thr->cmd_data.font_init.return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gl_font_init_first(font_driver, font_handle, video_data,
|
return font_init_first(font_driver, font_handle, video_data,
|
||||||
font_path, font_size);
|
font_path, font_size, FONT_DRIVER_RENDER_OPENGL_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void glui_context_reset(void)
|
static void glui_context_reset(void)
|
||||||
|
@ -1626,12 +1626,13 @@ static bool xmb_font_init_first(const void **font_driver,
|
|||||||
if (!thr)
|
if (!thr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
thr->cmd_data.font_init.method = gl_font_init_first;
|
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_driver = (const void**)font_driver;
|
||||||
thr->cmd_data.font_init.font_handle = font_handle;
|
thr->cmd_data.font_init.font_handle = font_handle;
|
||||||
thr->cmd_data.font_init.video_data = video_data;
|
thr->cmd_data.font_init.video_data = video_data;
|
||||||
thr->cmd_data.font_init.font_path = font_path;
|
thr->cmd_data.font_init.font_path = font_path;
|
||||||
thr->cmd_data.font_init.font_size = xmb_font_size;
|
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->send_cmd_func(thr, CMD_FONT_INIT);
|
||||||
thr->wait_reply_func(thr, CMD_FONT_INIT);
|
thr->wait_reply_func(thr, CMD_FONT_INIT);
|
||||||
@ -1639,8 +1640,8 @@ static bool xmb_font_init_first(const void **font_driver,
|
|||||||
return thr->cmd_data.font_init.return_value;
|
return thr->cmd_data.font_init.return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return gl_font_init_first(font_driver, font_handle, video_data,
|
return font_init_first(font_driver, font_handle, video_data,
|
||||||
font_path, xmb_font_size);
|
font_path, xmb_font_size, FONT_DRIVER_RENDER_OPENGL_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool xmb_load_wallpaper(void *data)
|
static bool xmb_load_wallpaper(void *data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user