gfx_display_font_free - useless wrapper function

This commit is contained in:
libretroadmin 2023-05-28 22:26:21 +02:00
parent a6c54a8e54
commit 5e94d81f33
7 changed files with 44 additions and 56 deletions

View File

@ -1186,13 +1186,6 @@ bool gfx_display_reset_textures_list(
return true;
}
/* Teardown; deinitializes and frees all
* fonts associated to the display driver */
void gfx_display_font_free(font_data_t *font)
{
font_driver_free(font);
}
void gfx_display_deinit_white_texture(void)
{
if (gfx_white_texture)

View File

@ -237,8 +237,6 @@ void gfx_display_scissor_begin(
unsigned video_height,
int x, int y, unsigned width, unsigned height);
void gfx_display_font_free(font_data_t *font);
bool gfx_display_init_first_driver(gfx_display_t *p_disp,
bool video_is_threaded);

View File

@ -64,7 +64,7 @@ static dispgfx_widget_t dispwidget_st = {0}; /* uint64_t alignment */
static void INLINE gfx_widgets_font_free(gfx_widget_font_data_t *font_data)
{
if (font_data->font)
gfx_display_font_free(font_data->font);
font_driver_free(font_data->font);
font_data->font = NULL;
font_data->usage_count = 0;
@ -746,7 +746,7 @@ static void gfx_widgets_font_init(
/* Free existing font */
if (font_data->font)
{
gfx_display_font_free(font_data->font);
font_driver_free(font_data->font);
font_data->font = NULL;
}

View File

@ -7885,6 +7885,7 @@ static void materialui_init_font(
const char *str_latin
)
{
char s1[PATH_MAX_LENGTH];
char fontpath[PATH_MAX_LENGTH];
const char *wideglyph_str = msg_hash_get_wideglyph_str();
settings_t *settings = config_get_ptr();
@ -7896,40 +7897,37 @@ static void materialui_init_font(
if (font_data->font)
{
gfx_display_font_free(font_data->font);
font_driver_free(font_data->font);
font_data->font = NULL;
}
{
char s1[PATH_MAX_LENGTH];
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "chinese-fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "korean-fallback-font.ttf",
sizeof(fontpath));
break;
default:
fill_pathname_join_special(s1, dir_assets, "glui", sizeof(s1));
fill_pathname_join_special(fontpath, s1, FILE_PATH_TTF_FONT,
sizeof(fontpath));
break;
}
switch (*msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
{
case RETRO_LANGUAGE_ARABIC:
case RETRO_LANGUAGE_PERSIAN:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_CHINESE_SIMPLIFIED:
case RETRO_LANGUAGE_CHINESE_TRADITIONAL:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "chinese-fallback-font.ttf",
sizeof(fontpath));
break;
case RETRO_LANGUAGE_KOREAN:
fill_pathname_join_special(s1,
settings->paths.directory_assets, "pkg", sizeof(s1));
fill_pathname_join_special(fontpath, s1, "korean-fallback-font.ttf",
sizeof(fontpath));
break;
default:
fill_pathname_join_special(s1, dir_assets, "glui", sizeof(s1));
fill_pathname_join_special(fontpath, s1, FILE_PATH_TTF_FONT,
sizeof(fontpath));
break;
}
font_data->font = gfx_display_font_file(p_disp,
@ -8325,15 +8323,15 @@ static void materialui_context_destroy(void *data)
/* Free fonts */
if (mui->font_data.title.font)
gfx_display_font_free(mui->font_data.title.font);
font_driver_free(mui->font_data.title.font);
mui->font_data.title.font = NULL;
if (mui->font_data.list.font)
gfx_display_font_free(mui->font_data.list.font);
font_driver_free(mui->font_data.list.font);
mui->font_data.list.font = NULL;
if (mui->font_data.hint.font)
gfx_display_font_free(mui->font_data.hint.font);
font_driver_free(mui->font_data.hint.font);
mui->font_data.hint.font = NULL;
/* Free node thumbnails */

View File

@ -8957,7 +8957,7 @@ static bool ozone_init_font(
/* Free existing */
if (font_data->font)
{
gfx_display_font_free(font_data->font);
font_driver_free(font_data->font);
font_data->font = NULL;
}
@ -9367,7 +9367,7 @@ static void ozone_unload_thumbnail_textures(void *data)
static void INLINE ozone_font_free(ozone_font_data_t *font_data)
{
if (font_data->font)
gfx_display_font_free(font_data->font);
font_driver_free(font_data->font);
font_data->font = NULL;
}

View File

@ -7335,12 +7335,12 @@ static void xmb_context_reset_internal(xmb_handle_t *xmb,
xmb_layout(xmb);
if (xmb->font)
{
gfx_display_font_free(xmb->font);
font_driver_free(xmb->font);
xmb->font = NULL;
}
if (xmb->font2)
{
gfx_display_font_free(xmb->font2);
font_driver_free(xmb->font2);
xmb->font2 = NULL;
}
fill_pathname_application_special(
@ -7743,10 +7743,9 @@ static void xmb_context_destroy(void *data)
xmb_context_destroy_horizontal_list(xmb);
xmb_context_bg_destroy(xmb);
gfx_display_font_free(xmb->font);
gfx_display_font_free(xmb->font2);
xmb->font = NULL;
font_driver_free(xmb->font);
xmb->font = NULL;
font_driver_free(xmb->font2);
xmb->font2 = NULL;
menu_screensaver_context_destroy(xmb->screensaver);

View File

@ -228,7 +228,7 @@ void menu_screensaver_free(menu_screensaver_t *screensaver)
/* Free font */
if (screensaver->font_data.font)
{
gfx_display_font_free(screensaver->font_data.font);
font_driver_free(screensaver->font_data.font);
video_coord_array_free(&screensaver->font_data.raster_block.carr);
screensaver->font_data.font = NULL;
@ -260,7 +260,7 @@ void menu_screensaver_context_destroy(menu_screensaver_t *screensaver)
* call of menu_screensaver_iterate()) */
if (screensaver->font_data.font)
{
gfx_display_font_free(screensaver->font_data.font);
font_driver_free(screensaver->font_data.font);
video_coord_array_free(&screensaver->font_data.raster_block.carr);
screensaver->font_data.font = NULL;
}
@ -428,7 +428,7 @@ static bool menu_screensaver_update_state(
/* Free any existing font */
if (screensaver->font_data.font)
{
gfx_display_font_free(screensaver->font_data.font);
font_driver_free(screensaver->font_data.font);
video_coord_array_free(&screensaver->font_data.raster_block.carr);
screensaver->font_data.font = NULL;
}