From 5e94d81f3329303f74d406fbc8f4600a6b8014af Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sun, 28 May 2023 22:26:21 +0200 Subject: [PATCH] gfx_display_font_free - useless wrapper function --- gfx/gfx_display.c | 7 ----- gfx/gfx_display.h | 2 -- gfx/gfx_widgets.c | 4 +-- menu/drivers/materialui.c | 66 +++++++++++++++++++-------------------- menu/drivers/ozone.c | 4 +-- menu/drivers/xmb.c | 11 +++---- menu/menu_screensaver.c | 6 ++-- 7 files changed, 44 insertions(+), 56 deletions(-) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index 8d3e96ffb2..8feddffbad 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -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) diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 8f5c321168..72e6a9c015 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -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); diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index a5140f4905..0ea65e14bb 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -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; } diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index cc9fde4fb9..4e07eeccdd 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -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 */ diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 1ff391a0ca..3e1cd1f8ec 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -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; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 029bab4395..2d9703024f 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -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); diff --git a/menu/menu_screensaver.c b/menu/menu_screensaver.c index f60497ff82..ad883a0f70 100644 --- a/menu/menu_screensaver.c +++ b/menu/menu_screensaver.c @@ -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; }