From 7d10c1a9ff9964f171832be0747e5fbf60b5dcb0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 13 Aug 2019 16:47:56 +0200 Subject: [PATCH] (menu widgets) No longer use video_driver_get_size --- menu/widgets/menu_widgets.c | 25 +++++++++---------------- menu/widgets/menu_widgets.h | 5 +++-- retroarch.c | 5 +++-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/menu/widgets/menu_widgets.c b/menu/widgets/menu_widgets.c index db1ce923d0..69aa885980 100644 --- a/menu/widgets/menu_widgets.c +++ b/menu/widgets/menu_widgets.c @@ -806,7 +806,7 @@ static void menu_widgets_hourglass_tick(void *userdata) menu_animation_push(&entry); } -void menu_widgets_iterate(void) +void menu_widgets_iterate(unsigned width, unsigned height) { size_t i; settings_t *settings = config_get_ptr(); @@ -891,12 +891,11 @@ void menu_widgets_iterate(void) if (screenshot_filename[0] != '\0') { menu_timer_ctx_entry_t timer; - unsigned width; - video_driver_texture_unload(&screenshot_texture); - menu_display_reset_textures_list(screenshot_filename, "", &screenshot_texture, TEXTURE_FILTER_MIPMAP_LINEAR, &screenshot_texture_width, &screenshot_texture_height); - video_driver_get_size(&width, NULL); + menu_display_reset_textures_list(screenshot_filename, + "", &screenshot_texture, TEXTURE_FILTER_MIPMAP_LINEAR, + &screenshot_texture_width, &screenshot_texture_height); screenshot_height = settings->floats.video_font_size * 4; screenshot_width = width; @@ -1755,27 +1754,21 @@ err: menu_widgets_free(); } -void menu_widgets_context_reset(bool is_threaded) +void menu_widgets_context_reset(bool is_threaded, + unsigned width, unsigned height) { + int i; char xmb_path[PATH_MAX_LENGTH]; + char monochrome_png_path[PATH_MAX_LENGTH]; char menu_widgets_path[PATH_MAX_LENGTH]; char theme_path[PATH_MAX_LENGTH]; - int i; - - char monochrome_png_path[PATH_MAX_LENGTH]; - char ozone_path[PATH_MAX_LENGTH]; char font_path[PATH_MAX_LENGTH]; - settings_t *settings = config_get_ptr(); - unsigned video_info_width; - if (!menu_widgets_inited) return; - video_driver_get_size(&video_info_width, NULL); - /* Textures paths */ fill_pathname_join( menu_widgets_path, @@ -1863,7 +1856,7 @@ void menu_widgets_context_reset(bool is_threaded) } msg_queue_text_scale_factor = 0.69f; - msg_queue_base_width = video_info_width / 4; + msg_queue_base_width = width / 4; msg_queue_spacing = msg_queue_height / 3; msg_queue_glyph_width = glyph_width * msg_queue_text_scale_factor; msg_queue_rect_start_x = msg_queue_spacing + msg_queue_icon_size_x; diff --git a/menu/widgets/menu_widgets.h b/menu/widgets/menu_widgets.h index a7e43848e8..a809a204c9 100644 --- a/menu/widgets/menu_widgets.h +++ b/menu/widgets/menu_widgets.h @@ -53,7 +53,7 @@ bool menu_widgets_volume_update_and_show(void); bool menu_widgets_set_fps_text(char *fps_text); -void menu_widgets_iterate(void); +void menu_widgets_iterate(unsigned width, unsigned height); bool menu_widgets_set_paused(bool is_paused); bool menu_widgets_set_fast_forward(bool is_fast_forward); @@ -69,7 +69,8 @@ void menu_widgets_screenshot_taken(const char *shotname, const char *filename); void menu_widgets_start_load_content_animation(const char *content_name, bool remove_extension); void menu_widgets_cleanup_load_content_animation(void); -void menu_widgets_context_reset(bool is_threaded); +void menu_widgets_context_reset(bool is_threaded, + unsigned width, unsigned height); void menu_widgets_context_destroy(void); diff --git a/retroarch.c b/retroarch.c index ed2ca0d2d1..e789fc340d 100644 --- a/retroarch.c +++ b/retroarch.c @@ -19648,7 +19648,8 @@ static void drivers_init(int flags) && video_driver_has_widgets()) { menu_widgets_init(video_is_threaded); - menu_widgets_context_reset(video_is_threaded); + menu_widgets_context_reset(video_is_threaded, + video_driver_width, video_driver_height); } #endif @@ -23234,7 +23235,7 @@ static enum runloop_state runloop_check_state(void) if (menu_widgets_ready()) { runloop_msg_queue_lock(); - menu_widgets_iterate(); + menu_widgets_iterate(video_driver_width, video_driver_height); runloop_msg_queue_unlock(); } #endif