From 45896eb26ec25916255b6038f8fa5d1855d8413c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 7 Jun 2020 18:17:53 +0200 Subject: [PATCH] (Ozone) Cleanups - move some static variables to only function that needed them - and some other cleanups in loops --- menu/drivers/ozone/ozone_sidebar.c | 22 +++++++--------------- menu/drivers/ozone/ozone_theme.c | 10 +++++----- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/menu/drivers/ozone/ozone_sidebar.c b/menu/drivers/ozone/ozone_sidebar.c index 55c48fb4c1..f7f474312f 100644 --- a/menu/drivers/ozone/ozone_sidebar.c +++ b/menu/drivers/ozone/ozone_sidebar.c @@ -128,6 +128,13 @@ void ozone_draw_sidebar( enum gfx_animation_ticker_type menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type; + selection_y = 0; + selection_old_y = 0; + horizontal_list_size = 0; + + if (!ozone->draw_sidebar) + return; + /* Initial ticker configuration */ if (use_smooth_ticker) { @@ -146,13 +153,6 @@ void ozone_draw_sidebar( ticker.spacer = ticker_spacer; } - selection_y = 0; - selection_old_y = 0; - horizontal_list_size = 0; - - if (!ozone->draw_sidebar) - return; - if (ozone->horizontal_list) horizontal_list_size = (unsigned)ozone->horizontal_list->size; @@ -608,13 +608,9 @@ void ozone_sidebar_goto(ozone_handle_t *ozone, unsigned new_selection) gfx_animation_push(&entry); if (new_selection > ozone->system_tab_end) - { ozone_change_tab(ozone, MENU_ENUM_LABEL_HORIZONTAL_MENU, MENU_SETTING_HORIZONTAL_MENU); - } else - { ozone_change_tab(ozone, ozone_system_tabs_idx[ozone->tabs[new_selection]], ozone_system_tabs_type[ozone->tabs[new_selection]]); - } } void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height) @@ -984,9 +980,7 @@ bool ozone_is_playlist(ozone_handle_t *ozone, bool depth) bool is_playlist; if (ozone->categories_selection_ptr > ozone->system_tab_end) - { is_playlist = true; - } else { switch (ozone->tabs[ozone->categories_selection_ptr]) @@ -1014,8 +1008,6 @@ bool ozone_is_playlist(ozone_handle_t *ozone, bool depth) } } - - if (depth) return is_playlist && ozone->depth == 1; diff --git a/menu/drivers/ozone/ozone_theme.c b/menu/drivers/ozone/ozone_theme.c index e5fe4d203e..7ebce88f95 100644 --- a/menu/drivers/ozone/ozone_theme.c +++ b/menu/drivers/ozone/ozone_theme.c @@ -294,9 +294,6 @@ ozone_theme_t *ozone_default_theme = &ozone_theme_dark; /* also used as * opacity */ float last_framebuffer_opacity = -1.0f; -static float background_running_alpha_top = 1.0f; -static float background_running_alpha_bottom = 0.75f; - void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) { ozone_theme_t *theme = ozone_default_theme; @@ -355,9 +352,12 @@ unsigned ozone_get_system_theme(void) #endif } -void ozone_set_background_running_opacity(ozone_handle_t *ozone, float framebuffer_opacity) +void ozone_set_background_running_opacity( + ozone_handle_t *ozone, float framebuffer_opacity) { - float *background = NULL; + static float background_running_alpha_top = 1.0f; + static float background_running_alpha_bottom = 0.75f; + float *background = NULL; if (!ozone || !ozone->theme->background_libretro_running) return;