mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Add function pointer for font_init_first
This commit is contained in:
parent
40aa2a1864
commit
2b59f18b83
@ -234,6 +234,41 @@ static const float *menu_display_d3d_get_tex_coords(void)
|
||||
return &d3d_tex_coords[0];
|
||||
}
|
||||
|
||||
static bool menu_display_d3d_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();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
if (settings->video.threaded && !hw_render->context_type)
|
||||
{
|
||||
thread_packet_t pkt;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
thread_video_t *thr = (thread_video_t*)driver->video_data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
pkt.type = CMD_FONT_INIT;
|
||||
pkt.data.font_init.method = font_init_first;
|
||||
pkt.data.font_init.font_driver = (const void**)font_driver;
|
||||
pkt.data.font_init.font_handle = font_handle;
|
||||
pkt.data.font_init.video_data = video_data;
|
||||
pkt.data.font_init.font_path = font_path;
|
||||
pkt.data.font_init.font_size = font_size;
|
||||
pkt.data.font_init.api = FONT_DRIVER_RENDER_DIRECT3D_API;
|
||||
|
||||
thr->send_and_wait(thr, &pkt);
|
||||
|
||||
return pkt.data.font_init.return_value;
|
||||
}
|
||||
|
||||
return font_init_first(font_driver, font_handle, video_data,
|
||||
font_path, font_size, FONT_DRIVER_RENDER_DIRECT3D_API);
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_d3d = {
|
||||
menu_display_d3d_draw,
|
||||
menu_display_d3d_draw_bg,
|
||||
@ -245,6 +280,7 @@ menu_display_ctx_driver_t menu_display_ctx_d3d = {
|
||||
menu_display_d3d_get_tex_coords,
|
||||
menu_display_d3d_texture_load,
|
||||
menu_display_d3d_texture_unload,
|
||||
menu_display_d3d_font_init_first,
|
||||
MENU_VIDEO_DRIVER_DIRECT3D,
|
||||
"menu_display_d3d",
|
||||
};
|
||||
|
@ -207,6 +207,41 @@ static const float *menu_display_gl_get_tex_coords(void)
|
||||
return &gl_tex_coords[0];
|
||||
}
|
||||
|
||||
static bool menu_display_gl_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();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
if (settings->video.threaded && !hw_render->context_type)
|
||||
{
|
||||
thread_packet_t pkt;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
thread_video_t *thr = (thread_video_t*)driver->video_data;
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
||||
pkt.type = CMD_FONT_INIT;
|
||||
pkt.data.font_init.method = font_init_first;
|
||||
pkt.data.font_init.font_driver = (const void**)font_driver;
|
||||
pkt.data.font_init.font_handle = font_handle;
|
||||
pkt.data.font_init.video_data = video_data;
|
||||
pkt.data.font_init.font_path = font_path;
|
||||
pkt.data.font_init.font_size = font_size;
|
||||
pkt.data.font_init.api = FONT_DRIVER_RENDER_OPENGL_API;
|
||||
|
||||
thr->send_and_wait(thr, &pkt);
|
||||
|
||||
return pkt.data.font_init.return_value;
|
||||
}
|
||||
|
||||
return font_init_first(font_driver, font_handle, video_data,
|
||||
font_path, font_size, FONT_DRIVER_RENDER_OPENGL_API);
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_gl = {
|
||||
menu_display_gl_draw,
|
||||
menu_display_gl_draw_bg,
|
||||
@ -218,6 +253,7 @@ menu_display_ctx_driver_t menu_display_ctx_gl = {
|
||||
menu_display_gl_get_tex_coords,
|
||||
menu_display_gl_texture_load,
|
||||
menu_display_gl_texture_unload,
|
||||
menu_display_gl_font_init_first,
|
||||
MENU_VIDEO_DRIVER_OPENGL,
|
||||
"menu_display_gl",
|
||||
};
|
||||
|
@ -88,6 +88,13 @@ static const float *menu_display_null_get_tex_coords(void)
|
||||
return &floats[0];
|
||||
}
|
||||
|
||||
static bool menu_display_null_font_init_first(const void **font_driver,
|
||||
void **font_handle, void *video_data, const char *font_path,
|
||||
float font_size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_null = {
|
||||
menu_display_null_draw,
|
||||
menu_display_null_draw_bg,
|
||||
@ -99,6 +106,7 @@ menu_display_ctx_driver_t menu_display_ctx_null = {
|
||||
menu_display_null_get_tex_coords,
|
||||
menu_display_null_texture_load,
|
||||
menu_display_null_texture_unload,
|
||||
menu_display_null_font_init_first,
|
||||
MENU_VIDEO_DRIVER_GENERIC,
|
||||
"menu_display_null",
|
||||
};
|
||||
|
@ -134,6 +134,13 @@ bool menu_display_font_init_first(const void **font_driver,
|
||||
void **font_handle, void *video_data, const char *font_path,
|
||||
float font_size)
|
||||
{
|
||||
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
|
||||
if (!menu_disp || !menu_disp->font_init_first)
|
||||
return false;
|
||||
|
||||
return menu_disp->font_init_first(font_driver, font_handle, video_data,
|
||||
font_path, font_size);
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
@ -577,8 +584,7 @@ void menu_display_blend_end(void)
|
||||
if (!menu_disp || !menu_disp->blend_end)
|
||||
return;
|
||||
|
||||
if (menu_disp)
|
||||
menu_disp->blend_end();
|
||||
menu_disp->blend_end();
|
||||
}
|
||||
|
||||
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
|
||||
|
@ -107,6 +107,9 @@ typedef struct menu_display_ctx_driver
|
||||
const float *(*get_tex_coords)(void);
|
||||
unsigned (*texture_load)(void *data, enum texture_filter_type type);
|
||||
void (*texture_unload)(uintptr_t *id);
|
||||
bool (*font_init_first)(const void **font_driver,
|
||||
void **font_handle, void *video_data, const char *font_path,
|
||||
float font_size);
|
||||
enum menu_display_driver_type type;
|
||||
const char *ident;
|
||||
} menu_display_ctx_driver_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user