mirror of
https://github.com/libretro/RetroArch
synced 2025-03-26 20:37:10 +00:00
Pass video_info to font driver functions
This commit is contained in:
parent
87c82797fd
commit
5879e551a5
@ -129,12 +129,6 @@ static void caca_render_msg(video_frame_info_t *video_info,
|
||||
caca_refresh_display(*font->caca->caca_display);
|
||||
}
|
||||
|
||||
static void caca_font_flush_block(unsigned width, unsigned height,
|
||||
void* data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void caca_font_bind_block(void* data, void* userdata)
|
||||
{
|
||||
(void)data;
|
||||
@ -147,6 +141,6 @@ font_renderer_t caca_font = {
|
||||
"caca font",
|
||||
caca_font_get_glyph, /* get_glyph */
|
||||
caca_font_bind_block, /* bind_block */
|
||||
caca_font_flush_block, /* flush */
|
||||
NULL, /* flush */
|
||||
caca_get_message_width /* get_message_width */
|
||||
};
|
||||
|
@ -441,11 +441,6 @@ static const struct font_glyph* ctr_font_get_glyph(
|
||||
return font->font_driver->get_glyph((void*)font->font_driver, code);
|
||||
}
|
||||
|
||||
static void ctr_font_flush_block(unsigned width, unsigned height, void* data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void ctr_font_bind_block(void* data, void* userdata)
|
||||
{
|
||||
(void)data;
|
||||
@ -460,6 +455,6 @@ font_renderer_t ctr_font =
|
||||
"ctrfont",
|
||||
ctr_font_get_glyph,
|
||||
ctr_font_bind_block,
|
||||
ctr_font_flush_block,
|
||||
NULL, /* flush_block */
|
||||
ctr_font_get_message_width,
|
||||
};
|
||||
|
@ -140,7 +140,8 @@ static void gdi_render_msg(
|
||||
SelectObject(font->gdi->memDC, font->gdi->bmp_old);
|
||||
}
|
||||
|
||||
static void gdi_font_flush_block(unsigned width, unsigned height, void* data)
|
||||
static void gdi_font_flush_block(unsigned width, unsigned height, void* data,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
@ -244,9 +244,9 @@ static int gl_get_message_width(void *data, const char *msg,
|
||||
return delta_x * scale;
|
||||
}
|
||||
|
||||
static void gl_raster_font_draw_vertices(gl_raster_t *font, const video_coords_t *coords)
|
||||
static void gl_raster_font_draw_vertices(gl_raster_t *font, const video_coords_t *coords,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
video_shader_ctx_mvp_t mvp;
|
||||
video_shader_ctx_coords_t coords_data;
|
||||
|
||||
if (font->atlas->dirty)
|
||||
@ -260,10 +260,8 @@ static void gl_raster_font_draw_vertices(gl_raster_t *font, const video_coords_t
|
||||
|
||||
video_shader_driver_set_coords(coords_data);
|
||||
|
||||
mvp.data = font->gl;
|
||||
mvp.matrix = &font->gl->mvp_no_rot;
|
||||
|
||||
video_shader_driver_set_mvp(mvp);
|
||||
video_info->cb_shader_set_mvp(font->gl,
|
||||
video_info->shader_data, &font->gl->mvp_no_rot);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, coords->vertices);
|
||||
}
|
||||
@ -271,7 +269,8 @@ static void gl_raster_font_draw_vertices(gl_raster_t *font, const video_coords_t
|
||||
static void gl_raster_font_render_line(
|
||||
gl_raster_t *font, const char *msg, unsigned msg_len,
|
||||
GLfloat scale, const GLfloat color[4], GLfloat pos_x,
|
||||
GLfloat pos_y, unsigned text_align)
|
||||
GLfloat pos_y, unsigned text_align,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
unsigned i;
|
||||
struct video_coords coords;
|
||||
@ -346,14 +345,15 @@ static void gl_raster_font_render_line(
|
||||
if (font->block)
|
||||
video_coord_array_append(&font->block->carr, &coords, coords.vertices);
|
||||
else
|
||||
gl_raster_font_draw_vertices(font, &coords);
|
||||
gl_raster_font_draw_vertices(font, &coords, video_info);
|
||||
}
|
||||
}
|
||||
|
||||
static void gl_raster_font_render_message(
|
||||
gl_raster_t *font, const char *msg, GLfloat scale,
|
||||
const GLfloat color[4], GLfloat pos_x, GLfloat pos_y,
|
||||
unsigned text_align)
|
||||
unsigned text_align,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
float line_height;
|
||||
int lines = 0;
|
||||
@ -363,7 +363,8 @@ static void gl_raster_font_render_message(
|
||||
{
|
||||
gl_raster_font_render_line(font,
|
||||
msg, (unsigned)strlen(msg), scale, color, pos_x,
|
||||
pos_y, text_align);
|
||||
pos_y, text_align,
|
||||
video_info);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -379,7 +380,8 @@ static void gl_raster_font_render_message(
|
||||
/* Draw the line */
|
||||
gl_raster_font_render_line(font,
|
||||
msg, msg_len, scale, color, pos_x,
|
||||
pos_y - (float)lines*line_height, text_align);
|
||||
pos_y - (float)lines*line_height, text_align,
|
||||
video_info);
|
||||
|
||||
if (!delim)
|
||||
break;
|
||||
@ -487,11 +489,13 @@ static void gl_raster_font_render_msg(
|
||||
if (font->gl)
|
||||
gl_raster_font_render_message(font, msg, scale, color_dark,
|
||||
x + scale * drop_x / font->gl->vp.width, y +
|
||||
scale * drop_y / font->gl->vp.height, text_align);
|
||||
scale * drop_y / font->gl->vp.height, text_align,
|
||||
video_info);
|
||||
}
|
||||
|
||||
if (font->gl)
|
||||
gl_raster_font_render_message(font, msg, scale, color, x, y, text_align);
|
||||
gl_raster_font_render_message(font, msg, scale, color,
|
||||
x, y, text_align, video_info);
|
||||
}
|
||||
|
||||
if (!font->block && font->gl)
|
||||
@ -517,7 +521,7 @@ static const struct font_glyph *gl_raster_font_get_glyph(
|
||||
}
|
||||
|
||||
static void gl_raster_font_flush_block(unsigned width, unsigned height,
|
||||
void *data)
|
||||
void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
gl_raster_t *font = (gl_raster_t*)data;
|
||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||
@ -526,7 +530,8 @@ static void gl_raster_font_flush_block(unsigned width, unsigned height,
|
||||
return;
|
||||
|
||||
gl_raster_font_setup_viewport(width, height, font, block->fullscreen);
|
||||
gl_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords);
|
||||
gl_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords,
|
||||
video_info);
|
||||
|
||||
if (font->gl)
|
||||
{
|
||||
|
@ -129,12 +129,6 @@ static void vga_render_msg(video_frame_info_t *video_info,
|
||||
}
|
||||
}
|
||||
|
||||
static void vga_font_flush_block(unsigned width, unsigned height,
|
||||
void* data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void vga_font_bind_block(void* data, void* userdata)
|
||||
{
|
||||
(void)data;
|
||||
@ -147,6 +141,6 @@ font_renderer_t vga_font = {
|
||||
"vga font",
|
||||
vga_font_get_glyph, /* get_glyph */
|
||||
vga_font_bind_block, /* bind_block */
|
||||
vga_font_flush_block, /* flush */
|
||||
NULL, /* flush */
|
||||
vga_get_message_width /* get_message_width */
|
||||
};
|
||||
|
@ -346,12 +346,6 @@ static const struct font_glyph *vita2d_font_get_glyph(
|
||||
return font->font_driver->get_glyph((void*)font->font_driver, code);
|
||||
}
|
||||
|
||||
static void vita2d_font_flush_block(unsigned width, unsigned height,
|
||||
void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void vita2d_font_bind_block(void *data, void *userdata)
|
||||
{
|
||||
(void)data;
|
||||
@ -364,6 +358,6 @@ font_renderer_t vita2d_vita_font = {
|
||||
"vita2dfont",
|
||||
vita2d_font_get_glyph,
|
||||
vita2d_font_bind_block,
|
||||
vita2d_font_flush_block,
|
||||
NULL, /* flush */
|
||||
vita2d_font_get_message_width,
|
||||
};
|
||||
|
@ -436,7 +436,7 @@ static const struct font_glyph *vulkan_raster_font_get_glyph(
|
||||
}
|
||||
|
||||
static void vulkan_raster_font_flush_block(unsigned width, unsigned height,
|
||||
void *data)
|
||||
void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
@ -401,11 +401,6 @@ static const struct font_glyph* wiiu_font_get_glyph(
|
||||
return font->font_driver->get_glyph((void*)font->font_driver, code);
|
||||
}
|
||||
|
||||
static void wiiu_font_flush_block(unsigned width, unsigned height, void* data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void wiiu_font_bind_block(void* data, void* userdata)
|
||||
{
|
||||
(void)data;
|
||||
@ -420,6 +415,6 @@ font_renderer_t wiiu_font =
|
||||
"wiiufont",
|
||||
wiiu_font_get_glyph,
|
||||
wiiu_font_bind_block,
|
||||
wiiu_font_flush_block,
|
||||
NULL, /* flush */
|
||||
wiiu_font_get_message_width,
|
||||
};
|
||||
|
@ -452,13 +452,15 @@ void font_driver_bind_block(void *font_data, void *block)
|
||||
font->renderer->bind_block(font->renderer_data, block);
|
||||
}
|
||||
|
||||
void font_driver_flush(unsigned width, unsigned height, void *font_data)
|
||||
void font_driver_flush(unsigned width, unsigned height, void *font_data,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
font_data_t *font = (font_data_t*)(font_data ? font_data : video_font_driver);
|
||||
if (font && font->renderer && font->renderer->flush)
|
||||
font->renderer->flush(width, height, font->renderer_data);
|
||||
font->renderer->flush(width, height, font->renderer_data, video_info);
|
||||
}
|
||||
|
||||
|
||||
int font_driver_get_message_width(void *font_data,
|
||||
const char *msg, unsigned len, float scale)
|
||||
{
|
||||
|
@ -113,7 +113,8 @@ typedef struct font_renderer
|
||||
|
||||
const struct font_glyph *(*get_glyph)(void *data, uint32_t code);
|
||||
void (*bind_block)(void *data, void *block);
|
||||
void (*flush)(unsigned width, unsigned height, void *data);
|
||||
void (*flush)(unsigned width, unsigned height, void *data,
|
||||
video_frame_info_t *video_info);
|
||||
|
||||
int (*get_message_width)(void *data, const char *msg, unsigned msg_len_full, float scale);
|
||||
} font_renderer_t;
|
||||
@ -154,7 +155,8 @@ void font_driver_bind_block(void *font_data, void *block);
|
||||
|
||||
int font_driver_get_message_width(void *font_data, const char *msg, unsigned len, float scale);
|
||||
|
||||
void font_driver_flush(unsigned width, unsigned height, void *font_data);
|
||||
void font_driver_flush(unsigned width, unsigned height, void *font_data,
|
||||
video_frame_info_t *video_info);
|
||||
|
||||
void font_driver_free(void *font_data);
|
||||
|
||||
|
@ -1502,10 +1502,12 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
|
||||
sublabel_color
|
||||
);
|
||||
|
||||
font_driver_flush(video_info->width, video_info->height, mui->font);
|
||||
font_driver_flush(video_info->width, video_info->height, mui->font,
|
||||
video_info);
|
||||
font_driver_bind_block(mui->font, NULL);
|
||||
|
||||
font_driver_flush(video_info->width, video_info->height, mui->font2);
|
||||
font_driver_flush(video_info->width, video_info->height, mui->font2,
|
||||
video_info);
|
||||
font_driver_bind_block(mui->font2, NULL);
|
||||
|
||||
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
|
||||
|
@ -3130,10 +3130,12 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
width,
|
||||
height);
|
||||
|
||||
font_driver_flush(video_info->width, video_info->height, xmb->font);
|
||||
font_driver_flush(video_info->width, video_info->height, xmb->font,
|
||||
video_info);
|
||||
font_driver_bind_block(xmb->font, NULL);
|
||||
|
||||
font_driver_flush(video_info->width, video_info->height, xmb->font2);
|
||||
font_driver_flush(video_info->width, video_info->height, xmb->font2,
|
||||
video_info);
|
||||
font_driver_bind_block(xmb->font2, NULL);
|
||||
|
||||
if (menu_input_dialog_get_display_kb())
|
||||
|
@ -993,7 +993,8 @@ static void zarch_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
zui->rendering = false;
|
||||
|
||||
font_driver_flush(video_info->width, video_info->height, zui->font);
|
||||
font_driver_flush(video_info->width, video_info->height, zui->font,
|
||||
video_info);
|
||||
font_driver_bind_block(zui->font, NULL);
|
||||
|
||||
menu_display_unset_viewport(video_info->width, video_info->height);
|
||||
|
Loading…
x
Reference in New Issue
Block a user