Get rid of font_driver_flush

This commit is contained in:
libretroadmin 2023-06-15 23:41:40 +02:00
parent 3861e6e3ba
commit 0c51321099
7 changed files with 28 additions and 30 deletions

View File

@ -674,6 +674,7 @@ static char* font_driver_reshape_msg(const char* msg, unsigned char *buffer, siz
: buffer;
unsigned char *dst = (unsigned char*)dst_buffer;
while (*src || reverse)
{
if (reverse)
@ -696,7 +697,7 @@ static char* font_driver_reshape_msg(const char* msg, unsigned char *buffer, siz
else if (replacement < 0x800)
{
*dst++ = 0xC0 | (replacement >> 6);
*dst++ = 0x80 | (replacement & 0x3F);
*dst++ = 0x80 | (replacement & 0x3F);
}
else if (replacement < 0x10000)
{
@ -705,14 +706,14 @@ static char* font_driver_reshape_msg(const char* msg, unsigned char *buffer, siz
src -= 2;
*dst++ = 0xE0 | ( replacement >> 12);
*dst++ = 0x80 | ((replacement >> 6) & 0x3F);
*dst++ = 0x80 | ( replacement & 0x3F);
*dst++ = 0x80 | ((replacement >> 6) & 0x3F);
*dst++ = 0x80 | ( replacement & 0x3F);
}
else
{
*dst++ = 0xF0 | (replacement >> 18);
*dst++ = 0x80 | ((replacement >> 12) & 0x3F);
*dst++ = 0x80 | ((replacement >> 6) & 0x3F);
*dst++ = 0x80 | ((replacement >> 6) & 0x3F);
*dst++ = 0x80 | ( replacement & 0x3F);
}
@ -792,13 +793,6 @@ 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)
{
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);
}
int font_driver_get_message_width(void *font_data,
const char *msg, size_t len, float scale)
{

View File

@ -86,8 +86,6 @@ void font_driver_bind_block(void *font_data, void *block);
int font_driver_get_message_width(void *font_data, const char *msg, size_t len, float scale);
void font_driver_flush(unsigned width, unsigned height, void *font_data);
void font_driver_free(font_data_t *font);
font_data_t *font_driver_init_first(

View File

@ -668,7 +668,8 @@ void gfx_widgets_flush_text(
if (!font_data || (font_data->usage_count == 0))
return;
font_driver_flush(video_width, video_height, font_data->font);
if (font_data->font && font_data->font->renderer && font_data->font->renderer->flush)
font_data->font->renderer->flush(video_width, video_height, font_data->font->renderer_data);
font_data->raster_block.carr.coords.vertices = 0;
font_data->usage_count = 0;
}

View File

@ -2206,13 +2206,14 @@ static void INLINE materialui_font_unbind(materialui_font_data_t *font_data)
/* Flushing is slow - only do it if font
* has actually been used */
void materialui_font_flush(
static void materialui_font_flush(
unsigned video_width, unsigned video_height,
materialui_font_data_t *font_data)
{
if (font_data->raster_block.carr.coords.vertices == 0)
return;
font_driver_flush(video_width, video_height, font_data->font);
if (font_data->font && font_data->font->renderer && font_data->font->renderer->flush)
font_data->font->renderer->flush(video_width, video_height, font_data->font->renderer_data);
font_data->raster_block.carr.coords.vertices = 0;
}

View File

@ -339,8 +339,8 @@ typedef struct
{
font_data_t *font;
video_font_raster_block_t raster_block; /* ptr alignment */
int glyph_width;
int wideglyph_width;
unsigned glyph_width;
unsigned wideglyph_width;
int line_height;
int line_ascender;
int line_centre_offset;
@ -2844,7 +2844,8 @@ static void ozone_font_flush(
{
if (font_data->raster_block.carr.coords.vertices == 0)
return;
font_driver_flush(video_width, video_height, font_data->font);
if (font_data->font && font_data->font->renderer && font_data->font->renderer->flush)
font_data->font->renderer->flush(video_width, video_height, font_data->font->renderer_data);
font_data->raster_block.carr.coords.vertices = 0;
}

View File

@ -6336,8 +6336,10 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
if (dispctx && dispctx->blend_end)
dispctx->blend_end(userdata);
font_driver_flush(video_width, video_height, xmb->font);
font_driver_flush(video_width, video_height, xmb->font2);
if (xmb->font && xmb->font->renderer && xmb->font->renderer->flush)
xmb->font->renderer->flush(video_width, video_height, xmb->font->renderer_data);
if (xmb->font2 && xmb->font2->renderer && xmb->font2->renderer->flush)
xmb->font2->renderer->flush(video_width, video_height, xmb->font2->renderer_data);
font_driver_bind_block(xmb->font, NULL);
font_driver_bind_block(xmb->font2, NULL);

View File

@ -753,13 +753,14 @@ void menu_screensaver_frame(menu_screensaver_t *screensaver,
unsigned video_height;
video_driver_state_t *video_st = video_state_get_ptr();
void *userdata = NULL;
font_data_t *font = NULL;
if (!screensaver)
return;
video_width = video_info->width;
video_height = video_info->height;
userdata = video_info->userdata;
font = screensaver->font_data.font;
video_width = video_info->width;
video_height = video_info->height;
userdata = video_info->userdata;
/* Set viewport */
if (video_st->current_video && video_st->current_video->set_viewport)
@ -779,11 +780,10 @@ void menu_screensaver_frame(menu_screensaver_t *screensaver,
NULL);
/* Draw particle effect, if required */
if ((screensaver->effect != MENU_SCREENSAVER_BLANK) &&
screensaver->font_data.font &&
screensaver->particles)
if ( (screensaver->effect != MENU_SCREENSAVER_BLANK)
&& font
&& screensaver->particles)
{
font_data_t *font = screensaver->font_data.font;
float y_centre_offset = screensaver->font_data.y_centre_offset;
float particle_scale = screensaver->particle_scale;
size_t i;
@ -812,7 +812,8 @@ void menu_screensaver_frame(menu_screensaver_t *screensaver,
/* Flush text and unbind font */
if (screensaver->font_data.raster_block.carr.coords.vertices != 0)
{
font_driver_flush(video_width, video_height, font);
if (font->renderer && font->renderer->flush)
font->renderer->flush(video_width, video_height, font->renderer_data);
screensaver->font_data.raster_block.carr.coords.vertices = 0;
}
font_driver_bind_block(font, NULL);