(Drivers font) Add parameter

This commit is contained in:
twinaphex 2020-03-09 21:34:14 +01:00
parent 0ee8119459
commit 43feea3496
22 changed files with 47 additions and 21 deletions

View File

@ -76,7 +76,9 @@ static const struct font_glyph *caca_font_get_glyph(
return NULL; return NULL;
} }
static void caca_render_msg(video_frame_info_t *video_info, static void caca_render_msg(
void *userdata,
video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)
{ {

View File

@ -355,6 +355,7 @@ static void ctr_font_render_message(
} }
static void ctr_font_render_msg( static void ctr_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void* data, const char* msg, void* data, const char* msg,
const struct font_params *params) const struct font_params *params)
@ -366,7 +367,7 @@ static void ctr_font_render_msg(
unsigned color, color_dark, r, g, b, unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark; alpha, r_dark, g_dark, b_dark, alpha_dark;
ctr_font_t * font = (ctr_font_t*)data; ctr_font_t * font = (ctr_font_t*)data;
ctr_video_t *ctr = (ctr_video_t*)video_info->userdata; ctr_video_t *ctr = (ctr_video_t*)userdata;
unsigned width = video_info->width; unsigned width = video_info->width;
unsigned height = video_info->height; unsigned height = video_info->height;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();

View File

@ -283,6 +283,7 @@ static void d3d10_font_render_message(
} }
static void d3d10_font_render_msg( static void d3d10_font_render_msg(
void *userdata,
video_frame_info_t* video_info, void* data, video_frame_info_t* video_info, void* data,
const char* msg, const struct font_params *params) const char* msg, const struct font_params *params)
{ {
@ -292,7 +293,7 @@ static void d3d10_font_render_msg(
unsigned color, color_dark, r, g, b, unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark; alpha, r_dark, g_dark, b_dark, alpha_dark;
d3d10_font_t* font = (d3d10_font_t*)data; d3d10_font_t* font = (d3d10_font_t*)data;
d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; d3d10_video_t* d3d10 = (d3d10_video_t*)userdata;
unsigned width = video_info->width; unsigned width = video_info->width;
unsigned height = video_info->height; unsigned height = video_info->height;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();

View File

@ -279,6 +279,7 @@ static void d3d11_font_render_message(
} }
static void d3d11_font_render_msg( static void d3d11_font_render_msg(
void *userdata,
video_frame_info_t* video_info, void* data, video_frame_info_t* video_info, void* data,
const char* msg, const struct font_params *params) const char* msg, const struct font_params *params)
{ {
@ -288,7 +289,7 @@ static void d3d11_font_render_msg(
unsigned color, color_dark, r, g, b, unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark; alpha, r_dark, g_dark, b_dark, alpha_dark;
d3d11_font_t* font = (d3d11_font_t*)data; d3d11_font_t* font = (d3d11_font_t*)data;
d3d11_video_t * d3d11 = (d3d11_video_t*)video_info->userdata; d3d11_video_t * d3d11 = (d3d11_video_t*)userdata;
unsigned width = video_info->width; unsigned width = video_info->width;
unsigned height = video_info->height; unsigned height = video_info->height;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();

View File

@ -292,6 +292,7 @@ static void d3d12_font_render_message(
} }
static void d3d12_font_render_msg( static void d3d12_font_render_msg(
void *userdata,
video_frame_info_t* video_info, void* data, video_frame_info_t* video_info, void* data,
const char* msg, const struct font_params *params) const char* msg, const struct font_params *params)
{ {
@ -300,7 +301,7 @@ static void d3d12_font_render_msg(
enum text_alignment text_align; enum text_alignment text_align;
unsigned color, color_dark, r, g, b, unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark; alpha, r_dark, g_dark, b_dark, alpha_dark;
d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; d3d12_video_t *d3d12 = (d3d12_video_t*)userdata;
d3d12_font_t* font = (d3d12_font_t*)data; d3d12_font_t* font = (d3d12_font_t*)data;
unsigned width = video_info->width; unsigned width = video_info->width;
unsigned height = video_info->height; unsigned height = video_info->height;

View File

@ -125,8 +125,11 @@ static int d3dfonts_w32_get_message_width(void* data, const char* msg,
return box.right - box.left; return box.right - box.left;
} }
static void d3dfonts_w32_render_msg(video_frame_info_t *video_info, static void d3dfonts_w32_render_msg(
void *data, const char *msg, const struct font_params *params) void *userdata,
video_frame_info_t *video_info,
void *data, const char *msg,
const struct font_params *params)
{ {
unsigned format; unsigned format;
unsigned a, r, g, b; unsigned a, r, g, b;

View File

@ -79,6 +79,7 @@ static const struct font_glyph *fpga_font_get_glyph(
} }
static void fpga_render_msg( static void fpga_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const void *userdata) const void *userdata)

View File

@ -84,6 +84,7 @@ static const struct font_glyph *gdi_font_get_glyph(
} }
static void gdi_render_msg( static void gdi_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -430,6 +430,7 @@ static void gl1_raster_font_setup_viewport(unsigned width, unsigned height,
} }
static void gl1_raster_font_render_msg( static void gl1_raster_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -339,6 +339,7 @@ static void gl_core_raster_font_setup_viewport(unsigned width, unsigned height,
} }
static void gl_core_raster_font_render_msg( static void gl_core_raster_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -413,6 +413,7 @@ static void gl_raster_font_setup_viewport(unsigned width, unsigned height,
} }
static void gl_raster_font_render_msg( static void gl_raster_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -518,9 +518,10 @@ static int metal_get_message_width(void *data, const char *msg,
} }
static void metal_raster_font_render_msg( static void metal_raster_font_render_msg(
video_frame_info_t *video_info, void *userdata,
void *data, const char *msg, video_frame_info_t *video_info,
const struct font_params *params) void *data, const char *msg,
const struct font_params *params)
{ {
MetalRaster *r = (__bridge MetalRaster *)data; MetalRaster *r = (__bridge MetalRaster *)data;
[r renderMessage:msg video:video_info params:params]; [r renderMessage:msg video:video_info params:params];

View File

@ -131,6 +131,7 @@ static void ps2_font_free_font(void *data, bool is_threaded)
} }
static void ps2_font_render_msg( static void ps2_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -75,16 +75,18 @@ static const struct font_glyph *sixel_font_get_glyph(
return NULL; return NULL;
} }
static void sixel_render_msg(video_frame_info_t *video_info, static void sixel_render_msg(
void *userdata,
video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *userdata) const struct font_params *_params)
{ {
float x, y, scale; float x, y, scale;
unsigned width, height; unsigned width, height;
unsigned newX, newY; unsigned newX, newY;
unsigned align; unsigned align;
sixel_raster_t *font = (sixel_raster_t*)data; sixel_raster_t *font = (sixel_raster_t*)data;
const struct font_params *params = (const struct font_params*)userdata; const struct font_params *params = (const struct font_params*)_params;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
float video_msg_pos_x = settings->floats.video_msg_pos_x; float video_msg_pos_x = settings->floats.video_msg_pos_x;
float video_msg_pos_y = settings->floats.video_msg_pos_y; float video_msg_pos_y = settings->floats.video_msg_pos_y;

View File

@ -247,15 +247,16 @@ static void switch_font_render_message(
} }
static void switch_font_render_msg( static void switch_font_render_msg(
video_frame_info_t *video_info, void *userdata,
void *data, const char *msg, video_frame_info_t *video_info,
const struct font_params *params) void *data, const char *msg,
const struct font_params *params)
{ {
float x, y, scale; float x, y, scale;
enum text_alignment text_align; enum text_alignment text_align;
unsigned color, r, g, b, alpha; unsigned color, r, g, b, alpha;
switch_font_t *font = (switch_font_t *)data; switch_font_t *font = (switch_font_t *)data;
switch_video_t *sw = (switch_video_t*)video_info->userdata; switch_video_t *sw = (switch_video_t*)userdata;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
float video_msg_color_r = settings->floats.video_msg_color_r; float video_msg_color_r = settings->floats.video_msg_color_r;
float video_msg_color_g = settings->floats.video_msg_color_g; float video_msg_color_g = settings->floats.video_msg_color_g;

View File

@ -76,7 +76,9 @@ static const struct font_glyph *vga_font_get_glyph(
return NULL; return NULL;
} }
static void vga_render_msg(video_frame_info_t *video_info, static void vga_render_msg(
void *userdata,
video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)
{ {

View File

@ -261,6 +261,7 @@ static void vita2d_font_render_message(
} }
static void vita2d_font_render_msg( static void vita2d_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -335,6 +335,7 @@ static void vulkan_raster_font_flush(vulkan_raster_t *font)
} }
static void vulkan_raster_font_render_msg( static void vulkan_raster_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -284,6 +284,7 @@ static void wiiu_font_render_message(
} }
static void wiiu_font_render_msg( static void wiiu_font_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void* data, const char* msg, void* data, const char* msg,
const struct font_params *params) const struct font_params *params)
@ -294,7 +295,7 @@ static void wiiu_font_render_msg(
enum text_alignment text_align; enum text_alignment text_align;
unsigned color, color_dark, r, g, b, unsigned color, color_dark, r, g, b,
alpha, r_dark, g_dark, b_dark, alpha_dark; alpha, r_dark, g_dark, b_dark, alpha_dark;
wiiu_video_t *wiiu = (wiiu_video_t*)video_info->userdata; wiiu_video_t *wiiu = (wiiu_video_t*)userdata;
wiiu_font_t *font = (wiiu_font_t*)data; wiiu_font_t *font = (wiiu_font_t*)data;
unsigned width = video_info->width; unsigned width = video_info->width;
unsigned height = video_info->height; unsigned height = video_info->height;

View File

@ -74,6 +74,7 @@ static void xfonts_free_font(void *data, bool is_threaded)
} }
static void xfonts_render_msg( static void xfonts_render_msg(
void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params) const struct font_params *params)

View File

@ -1048,7 +1048,8 @@ void font_driver_render_msg(
char *new_msg = (char*)msg; char *new_msg = (char*)msg;
#endif #endif
font->renderer->render_msg(video_info, font->renderer->render_msg(data,
video_info,
font->renderer_data, new_msg, params); font->renderer_data, new_msg, params);
#ifdef HAVE_LANGEXTRA #ifdef HAVE_LANGEXTRA
free(new_msg); free(new_msg);

View File

@ -86,7 +86,7 @@ typedef struct font_renderer
void *(*init)(void *data, const char *font_path, void *(*init)(void *data, const char *font_path,
float font_size, bool is_threaded); float font_size, bool is_threaded);
void (*free)(void *data, bool is_threaded); void (*free)(void *data, bool is_threaded);
void (*render_msg)( void (*render_msg)(void *userdata,
video_frame_info_t *video_info, video_frame_info_t *video_info,
void *data, const char *msg, void *data, const char *msg,
const struct font_params *params); const struct font_params *params);