From f38eb84cc7fc0e608f71474446668d76c834d478 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 28 Sep 2020 03:38:16 +0200 Subject: [PATCH] Move gfx_display_draw_text to retroarch.c and get rid of video_driver_set_osd_msg --- gfx/gfx_display.c | 40 ---------------------------------------- retroarch.c | 40 ++++++++++++++++++++++++++++++++++++++-- retroarch.h | 3 --- 3 files changed, 38 insertions(+), 45 deletions(-) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index f4e8654a56..2c278cdae7 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -1608,46 +1608,6 @@ void gfx_display_draw_keyboard( } } -/* Draw text on top of the screen */ -void gfx_display_draw_text( - const font_data_t *font, const char *text, - float x, float y, int width, int height, - uint32_t color, enum text_alignment text_align, - float scale, bool shadows_enable, float shadow_offset, - bool draw_outside) -{ - struct font_params params; - - if ((color & 0x000000FF) == 0) - return; - - /* Don't draw outside of the screen */ - if (!draw_outside && - ((x < -64 || x > width + 64) - || (y < -64 || y > height + 64)) - ) - return; - - params.x = x / width; - params.y = 1.0f - y / height; - params.scale = scale; - params.drop_mod = 0.0f; - params.drop_x = 0.0f; - params.drop_y = 0.0f; - params.color = color; - params.full_screen = true; - params.text_align = text_align; - - if (shadows_enable) - { - params.drop_x = shadow_offset; - params.drop_y = -shadow_offset; - params.drop_alpha = 0.35f; - } - - video_driver_set_osd_msg(text, ¶ms, (void*)font); -} - /* NOTE: Reads image from file */ bool gfx_display_reset_textures_list( const char *texture_path, const char *iconpath, diff --git a/retroarch.c b/retroarch.c index 9869178987..485d394d37 100644 --- a/retroarch.c +++ b/retroarch.c @@ -32427,14 +32427,50 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height) return true; } -void video_driver_set_osd_msg(const char *msg, const void *data, void *font) +/* Draw text on top of the screen */ +void gfx_display_draw_text( + const font_data_t *font, const char *text, + float x, float y, int width, int height, + uint32_t color, enum text_alignment text_align, + float scale, bool shadows_enable, float shadow_offset, + bool draw_outside) { + struct font_params params; struct rarch_state *p_rarch = &rarch_st; + + if ((color & 0x000000FF) == 0) + return; + + /* Don't draw outside of the screen */ + if (!draw_outside && + ((x < -64 || x > width + 64) + || (y < -64 || y > height + 64)) + ) + return; + + params.x = x / width; + params.y = 1.0f - y / height; + params.scale = scale; + params.drop_mod = 0.0f; + params.drop_x = 0.0f; + params.drop_y = 0.0f; + params.color = color; + params.full_screen = true; + params.text_align = text_align; + + if (shadows_enable) + { + params.drop_x = shadow_offset; + params.drop_y = -shadow_offset; + params.drop_alpha = 0.35f; + } + if (p_rarch->video_driver_poke && p_rarch->video_driver_poke->set_osd_msg) p_rarch->video_driver_poke->set_osd_msg(p_rarch->video_driver_data, - msg, data, font); + text, ¶ms, (void*)font); } + void video_driver_set_texture_enable(bool enable, bool fullscreen) { struct rarch_state *p_rarch = &rarch_st; diff --git a/retroarch.h b/retroarch.h index 26d203306e..9c65ca5c2c 100644 --- a/retroarch.h +++ b/retroarch.h @@ -1591,9 +1591,6 @@ bool video_driver_set_video_mode(unsigned width, bool video_driver_get_video_output_size( unsigned *width, unsigned *height); -void video_driver_set_osd_msg(const char *msg, - const void *params, void *font); - void video_driver_set_texture_enable(bool enable, bool full_screen); void video_driver_set_texture_frame(const void *frame, bool rgb32,