From a19c61ec7f9ef40d1316f0ed0f49da1e14435b53 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 21 Mar 2021 11:03:00 +0100 Subject: [PATCH] (Ozone) Cut down on pointer grabbing - reduce calls to disp_get_ptr and anim_get_ptr --- menu/drivers/ozone/ozone.c | 358 ++++++++++++++++------------- menu/drivers/ozone/ozone.h | 10 +- menu/drivers/ozone/ozone_display.c | 25 +- menu/drivers/ozone/ozone_display.h | 5 + menu/drivers/ozone/ozone_entries.c | 169 ++++++++------ menu/drivers/ozone/ozone_sidebar.c | 14 +- 6 files changed, 335 insertions(+), 246 deletions(-) diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 8981b9f764..b081184647 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -1747,7 +1747,7 @@ static void ozone_render(void *data, if (ozone->need_compute) { - ozone_compute_entries_position(ozone); + ozone_compute_entries_position(ozone, entries_end); ozone->need_compute = false; } @@ -2194,38 +2194,46 @@ static void ozone_draw_header( false); /* Icon */ - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + { #if 0 - if (discord_avatar_is_ready()) - ozone_draw_icon( - userdata, - video_width, - video_height, - logo_icon_size, - logo_icon_size, - ozone->textures[OZONE_TEXTURE_DISCORD_OWN_AVATAR], - 47 * scale_factor, - 14 * scale_factor, /* Where does this come from...? */ - video_width, - video_height, - 0, 1, col); - else + if (discord_avatar_is_ready()) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + logo_icon_size, + logo_icon_size, + ozone->textures[OZONE_TEXTURE_DISCORD_OWN_AVATAR], + 47 * scale_factor, + 14 * scale_factor, /* Where does this come from...? */ + video_width, + video_height, + 0, 1, col); + else #endif - ozone_draw_icon( - userdata, - video_width, - video_height, - logo_icon_size, - logo_icon_size, - ozone->textures[OZONE_TEXTURE_RETROARCH], - 47 * scale_factor, - (ozone->dimensions.header_height - logo_icon_size) / 2, - video_width, - video_height, - 0, 1, col); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + logo_icon_size, + logo_icon_size, + ozone->textures[OZONE_TEXTURE_RETROARCH], + 47 * scale_factor, + (ozone->dimensions.header_height - logo_icon_size) / 2, + video_width, + video_height, + 0, 1, col); + } + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } /* Battery */ if (battery_level_enable) @@ -2259,22 +2267,27 @@ static void ozone_draw_header( 1.0f, false); - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - status_icon_size, - status_icon_size, - ozone->icons_textures[powerstate.charging? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING : (powerstate.percent > 80)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL : (powerstate.percent > 60)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_80 : (powerstate.percent > 40)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_60 : (powerstate.percent > 20)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_40 : OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_20], - video_width - (60 + 56) * scale_factor, - 0, - video_width, - video_height, - 0, 1, col); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + status_icon_size, + status_icon_size, + ozone->icons_textures[powerstate.charging? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_CHARGING : (powerstate.percent > 80)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_FULL : (powerstate.percent > 60)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_80 : (powerstate.percent > 40)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_60 : (powerstate.percent > 20)? OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_40 : OZONE_ENTRIES_ICONS_TEXTURE_BATTERY_20], + video_width - (60 + 56) * scale_factor, + 0, + video_width, + video_height, + 0, 1, col); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } } } @@ -2308,22 +2321,27 @@ static void ozone_draw_header( 1.0f, false); - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - status_icon_size, - status_icon_size, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOCK], - video_width - (60 + 56) * scale_factor - timedate_offset, - 0, - video_width, - video_height, - 0, 1, col); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + status_icon_size, + status_icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CLOCK], + video_width - (60 + 56) * scale_factor - timedate_offset, + 0, + video_width, + video_height, + 0, 1, col); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } } } @@ -2403,84 +2421,95 @@ static void ozone_draw_footer( /* Buttons */ /* Draw icons */ - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - gfx_display_set_alpha(ozone->theme_dynamic.entries_icon, 1.0f); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + gfx_display_set_alpha(ozone->theme_dynamic.entries_icon, 1.0f); - /* > ok */ - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - input_menu_swap_ok_cancel_buttons ? + if (dispctx->draw) + { + /* > ok */ + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + input_menu_swap_ok_cancel_buttons ? ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D] : ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R], - ok_x, - icon_y, - video_width, - video_height, - 0, 1, col); + ok_x, + icon_y, + video_width, + video_height, + 0, 1, col); - /* > back */ - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - input_menu_swap_ok_cancel_buttons ? + /* > back */ + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + input_menu_swap_ok_cancel_buttons ? ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_R] : ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D], - back_x, - icon_y, - video_width,video_height, - 0, 1, col); + back_x, + icon_y, + video_width,video_height, + 0, 1, col); - /* > search */ - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], - search_x, - icon_y, - video_width,video_height, - 0, 1, col); + /* > search */ + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_U], + search_x, + icon_y, + video_width,video_height, + 0, 1, col); - /* > fullscreen_thumbs */ - if (fullscreen_thumbnails_available) - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START], - fullscreen_thumbs_x, - icon_y, - video_width,video_height, - 0, 1, col); + /* > fullscreen_thumbs */ + if (fullscreen_thumbnails_available) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_START], + fullscreen_thumbs_x, + icon_y, + video_width,video_height, + 0, 1, col); - /* > metadata_toggle */ - if (metadata_override_available) - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SELECT], - metadata_toggle_x, - icon_y, - video_width,video_height, - 0, 1, col); + /* > metadata_toggle */ + if (metadata_override_available) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SELECT], + metadata_toggle_x, + icon_y, + video_width,video_height, + 0, 1, col); + } - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } /* Draw labels */ @@ -2644,24 +2673,29 @@ static void ozone_draw_footer( } else { - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - 69 * scale_factor, - 30 * scale_factor, - ozone->theme->textures[OZONE_THEME_TEXTURE_SWITCH], - footer_margin, - video_height - ozone->dimensions.footer_height / 2 - 15 * scale_factor, - video_width, - video_height, - 0, - 1, - ozone->pure_white); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + 69 * scale_factor, + 30 * scale_factor, + ozone->theme->textures[OZONE_THEME_TEXTURE_SWITCH], + footer_margin, + video_height - ozone->dimensions.footer_height / 2 - 15 * scale_factor, + video_width, + video_height, + 0, + 1, + ozone->pure_white); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } } } @@ -2942,12 +2976,16 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) settings); /* Sidebar */ - ozone_draw_sidebar(ozone, - userdata, - video_width, - video_height, - libretro_running, - menu_framebuffer_opacity); + if (ozone->draw_sidebar) + ozone_draw_sidebar( + ozone, + p_disp, + p_anim, + userdata, + video_width, + video_height, + libretro_running, + menu_framebuffer_opacity); /* Menu entries */ gfx_display_scissor_begin(userdata, @@ -2962,6 +3000,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) /* Current list */ ozone_draw_entries( ozone, + p_disp, + p_anim, userdata, video_width, video_height, @@ -2977,6 +3017,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) if (ozone->draw_old_list) ozone_draw_entries( ozone, + p_disp, + p_anim, userdata, video_width, video_height, @@ -2991,6 +3033,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) /* Thumbnail bar */ if (ozone->show_thumbnail_bar) ozone_draw_thumbnail_bar(ozone, + p_disp, + p_anim, userdata, video_width, video_height, @@ -3074,7 +3118,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) label, str); } else - ozone_draw_messagebox(ozone, + ozone_draw_messagebox( + ozone, + p_disp, userdata, video_width, video_height, diff --git a/menu/drivers/ozone/ozone.h b/menu/drivers/ozone/ozone.h index 578c26ce1a..9266a36ec7 100644 --- a/menu/drivers/ozone/ozone.h +++ b/menu/drivers/ozone/ozone.h @@ -25,6 +25,8 @@ typedef struct ozone_handle ozone_handle_t; #include #include +#include "../../gfx/gfx_animation.h" +#include "../../gfx/gfx_display.h" #include "../../gfx/gfx_thumbnail_path.h" #include "../../gfx/gfx_thumbnail.h" @@ -323,6 +325,8 @@ typedef struct ozone_node void ozone_draw_entries( ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, @@ -335,6 +339,8 @@ void ozone_draw_entries( void ozone_draw_sidebar( ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, @@ -372,7 +378,7 @@ void ozone_free_list_nodes(file_list_t *list, bool actiondata); bool ozone_is_playlist(ozone_handle_t *ozone, bool depth); -void ozone_compute_entries_position(ozone_handle_t *ozone); +void ozone_compute_entries_position(ozone_handle_t *ozone, size_t entries_end); void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node_t *node); @@ -384,6 +390,8 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist, void ozone_draw_thumbnail_bar( ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, diff --git a/menu/drivers/ozone/ozone_display.c b/menu/drivers/ozone/ozone_display.c index 6ced47eb05..898cd4446c 100644 --- a/menu/drivers/ozone/ozone_display.c +++ b/menu/drivers/ozone/ozone_display.c @@ -83,6 +83,7 @@ static void ozone_cursor_animation_cb(void *userdata) static void ozone_draw_cursor_slice( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -95,9 +96,10 @@ static void ozone_draw_cursor_slice( int slice_y = (int)y + 8 * scale_factor; unsigned slice_new_w = width + (24 + 1) * scale_factor; unsigned slice_new_h = height + 20 * scale_factor; - gfx_display_t *p_disp = disp_get_ptr(); - gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; - static float last_alpha = 0.0f; + gfx_display_ctx_driver_t + *dispctx = p_disp->dispctx; + static float + last_alpha = 0.0f; if (alpha != last_alpha) { @@ -253,6 +255,7 @@ void ozone_restart_cursor_animation(ozone_handle_t *ozone) void ozone_draw_cursor( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -269,7 +272,9 @@ void ozone_draw_cursor( /* Draw the cursor */ if (ozone->has_all_assets) - ozone_draw_cursor_slice(ozone, userdata, + ozone_draw_cursor_slice(ozone, + p_disp, + userdata, video_width, video_height, new_x, width, height, new_y, alpha); else @@ -281,6 +286,7 @@ void ozone_draw_cursor( } void ozone_draw_icon( + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -296,8 +302,6 @@ void ozone_draw_icon( gfx_display_ctx_draw_t draw; struct video_coords coords; math_matrix_4x4 mymat; - gfx_display_t - *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; @@ -329,8 +333,7 @@ void ozone_draw_icon( draw.pipeline_id = 0; if (draw.height > 0 && draw.width > 0) - if (dispctx && dispctx->draw) - dispctx->draw(&draw, userdata, video_width, video_height); + dispctx->draw(&draw, userdata, video_width, video_height); } void ozone_draw_backdrop( @@ -548,6 +551,7 @@ void ozone_draw_osk(ozone_handle_t *ozone, void ozone_draw_messagebox( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -561,14 +565,13 @@ void ozone_draw_messagebox( float scale_factor = 0.0f; unsigned width = video_width; unsigned height = video_height; - gfx_display_t *p_disp = disp_get_ptr(); - gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; + gfx_display_ctx_driver_t + *dispctx = p_disp->dispctx; wrapped_message[0] = '\0'; /* Sanity check */ if (string_is_empty(message) || - !ozone || !ozone->fonts.footer.font) return; diff --git a/menu/drivers/ozone/ozone_display.h b/menu/drivers/ozone/ozone_display.h index d29cadd391..0e7e32e716 100644 --- a/menu/drivers/ozone/ozone_display.h +++ b/menu/drivers/ozone/ozone_display.h @@ -19,10 +19,13 @@ #include "ozone.h" +#include "../../../gfx/gfx_display.h" + #include "../../menu_driver.h" void ozone_draw_cursor( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -31,6 +34,7 @@ void ozone_draw_cursor( size_t y, float alpha); void ozone_draw_icon( + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -59,6 +63,7 @@ void ozone_draw_osk( void ozone_draw_messagebox( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, diff --git a/menu/drivers/ozone/ozone_entries.c b/menu/drivers/ozone/ozone_entries.c index 9d73b8a2e4..79e8351cb8 100644 --- a/menu/drivers/ozone/ozone_entries.c +++ b/menu/drivers/ozone/ozone_entries.c @@ -47,6 +47,7 @@ static int ozone_get_entries_padding(ozone_handle_t* ozone, bool old_list) static void ozone_draw_entry_value( ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -58,7 +59,6 @@ static void ozone_draw_entry_value( bool switch_is_on = true; bool do_draw_text = false; float scale_factor = ozone->last_scale_factor; - gfx_display_t *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; /* check icon */ @@ -68,6 +68,7 @@ static void ozone_draw_entry_value( if (dispctx && dispctx->blend_begin) dispctx->blend_begin(userdata); ozone_draw_icon( + p_disp, userdata, video_width, video_height, @@ -164,7 +165,9 @@ static void ozone_thumbnail_bar_hide_end(void *userdata) ozone->show_thumbnail_bar = false; } -static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone, +static void ozone_draw_no_thumbnail_available( + ozone_handle_t *ozone, + gfx_display_t *p_disp, void *userdata, unsigned video_width, unsigned video_height, @@ -172,28 +175,33 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone, unsigned sidebar_width, unsigned y_offset) { - unsigned icon = OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO; - unsigned icon_size = (unsigned)((float)ozone->dimensions.sidebar_entry_icon_size * 1.5f); - gfx_display_t *p_disp = disp_get_ptr(); + unsigned icon = OZONE_ENTRIES_ICONS_TEXTURE_CORE_INFO; + unsigned icon_size = (unsigned)((float) + ozone->dimensions.sidebar_entry_icon_size * 1.5f); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; float *col = ozone->theme->entries_icon; - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - ozone->icons_textures[icon], - x_position + sidebar_width/2 - icon_size/2, - video_height/2 - icon_size/2 - y_offset, - video_width, - video_height, - 0, 1, col); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[icon], + x_position + sidebar_width/2 - icon_size/2, + video_height/2 - icon_size/2 - y_offset, + video_width, + video_height, + 0, 1, col); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } gfx_display_draw_text( ozone->fonts.footer.font, @@ -315,13 +323,14 @@ void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node } } -void ozone_compute_entries_position(ozone_handle_t *ozone) +void ozone_compute_entries_position( + ozone_handle_t *ozone, + size_t entries_end) { /* Compute entries height and adjust scrolling if needed */ unsigned video_info_height; unsigned video_info_width; - size_t i, entries_end; - + size_t i; file_list_t *selection_buf = NULL; int entry_padding = ozone_get_entries_padding(ozone, false); float scale_factor = ozone->last_scale_factor; @@ -330,7 +339,6 @@ void ozone_compute_entries_position(ozone_handle_t *ozone) menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i); - entries_end = menu_entries_get_size(); selection_buf = menu_entries_get_selection_buf_ptr(0); video_driver_get_size(&video_info_width, &video_info_height); @@ -468,6 +476,8 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist, void ozone_draw_entries( ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, @@ -494,9 +504,7 @@ void ozone_draw_entries( size_t old_selection_y = 0; int entry_padding = ozone_get_entries_padding(ozone, old_list); float scale_factor = ozone->last_scale_factor; - gfx_display_t *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; - gfx_animation_t *p_anim = anim_get_ptr(); size_t entries_end = selection_buf ? selection_buf->size : 0; size_t y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.entry_padding_vertical; float sidebar_offset = ozone->sidebar_offset; @@ -590,6 +598,7 @@ border_iterate: if (!ozone->cursor_in_sidebar) ozone_draw_cursor( ozone, + p_disp, userdata, video_width, video_height, @@ -604,6 +613,7 @@ border_iterate: if (!ozone->cursor_in_sidebar_old) ozone_draw_cursor( ozone, + p_disp, userdata, video_width, video_height, @@ -785,27 +795,32 @@ border_iterate: gfx_display_set_alpha(icon_color, alpha); - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - ozone->dimensions.entry_icon_size, - ozone->dimensions.entry_icon_size, - texture, - (unsigned)ozone->dimensions_sidebar_width - + x_offset + entry_padding - + ozone->dimensions.entry_icon_padding, - y + scroll_y + ozone->dimensions.entry_height - / 2 - ozone->dimensions.entry_icon_size / 2, - video_width, - video_height, - 0, - 1, - icon_color); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + ozone->dimensions.entry_icon_size, + ozone->dimensions.entry_icon_size, + texture, + (unsigned)ozone->dimensions_sidebar_width + + x_offset + entry_padding + + ozone->dimensions.entry_icon_padding, + y + scroll_y + ozone->dimensions.entry_height + / 2 - ozone->dimensions.entry_icon_size / 2, + video_width, + video_height, + 0, + 1, + icon_color); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } if (icon_color == ozone->pure_white) gfx_display_set_alpha(icon_color, 1.0f); @@ -880,6 +895,7 @@ border_iterate: } ozone_draw_entry_value(ozone, + p_disp, userdata, video_width, video_height, @@ -901,13 +917,18 @@ border_iterate: ozone_font_flush(video_width, video_height, &ozone->fonts.entries_sublabel); } -void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, +void ozone_draw_thumbnail_bar( + ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, bool libretro_running, float menu_framebuffer_opacity) { + enum gfx_thumbnail_alignment right_thumbnail_alignment; + enum gfx_thumbnail_alignment left_thumbnail_alignment; unsigned sidebar_width = ozone->dimensions.thumbnail_bar_width; unsigned thumbnail_width = sidebar_width - (ozone->dimensions.sidebar_entry_icon_padding * 2); int right_thumbnail_y_position = 0; @@ -920,11 +941,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, int thumbnail_x_position = x_position + ozone->dimensions.sidebar_entry_icon_padding; unsigned thumbnail_height = (video_height - ozone->dimensions.header_height - ozone->dimensions.spacer_2px - ozone->dimensions.footer_height - (ozone->dimensions.sidebar_entry_icon_padding * 3)) / 2; float scale_factor = ozone->last_scale_factor; - enum gfx_thumbnail_alignment right_thumbnail_alignment; - enum gfx_thumbnail_alignment left_thumbnail_alignment; - gfx_display_t *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; - gfx_animation_t *p_anim = anim_get_ptr(); /* Background */ if (!libretro_running || (menu_framebuffer_opacity >= 1.0f)) @@ -980,6 +997,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, { ozone_draw_no_thumbnail_available( ozone, + p_disp, userdata, video_width, video_height, @@ -1032,7 +1050,9 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, * a left thumbnail to show in its place, * display 'no thumbnail available' message */ else if (!show_left_thumbnail) - ozone_draw_no_thumbnail_available(ozone, + ozone_draw_no_thumbnail_available( + ozone, + p_disp, userdata, video_width, video_height, @@ -1317,24 +1337,29 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, /* > Set its opacity to a maximum of 80% */ gfx_display_set_alpha(ozone->theme_dynamic.entries_icon, metadata_alpha * 0.8f); - /* Draw icon in the bottom right corner of - * the thumbnail bar */ - if (dispctx && dispctx->blend_begin) - dispctx->blend_begin(userdata); - ozone_draw_icon( - userdata, - video_width, - video_height, - icon_size, - icon_size, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_IMAGE], - x_position + sidebar_width - separator_padding - icon_size, - video_height - ozone->dimensions.footer_height - ozone->dimensions.sidebar_entry_icon_padding - icon_size, - video_width, - video_height, - 0, 1, col); - if (dispctx && dispctx->blend_end) - dispctx->blend_end(userdata); + if (dispctx) + { + /* Draw icon in the bottom right corner of + * the thumbnail bar */ + if (dispctx->blend_begin) + dispctx->blend_begin(userdata); + if (dispctx->draw) + ozone_draw_icon( + p_disp, + userdata, + video_width, + video_height, + icon_size, + icon_size, + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_IMAGE], + x_position + sidebar_width - separator_padding - icon_size, + video_height - ozone->dimensions.footer_height - ozone->dimensions.sidebar_entry_icon_padding - icon_size, + video_width, + video_height, + 0, 1, col); + if (dispctx->blend_end) + dispctx->blend_end(userdata); + } } } } diff --git a/menu/drivers/ozone/ozone_sidebar.c b/menu/drivers/ozone/ozone_sidebar.c index d373aa39c7..db03a646f2 100644 --- a/menu/drivers/ozone/ozone_sidebar.c +++ b/menu/drivers/ozone/ozone_sidebar.c @@ -158,6 +158,8 @@ static float ozone_sidebar_get_scroll_y( void ozone_draw_sidebar( ozone_handle_t *ozone, + gfx_display_t *p_disp, + gfx_animation_t *p_anim, void *userdata, unsigned video_width, unsigned video_height, @@ -185,12 +187,7 @@ void ozone_draw_sidebar( unsigned selection_y = 0; unsigned selection_old_y = 0; unsigned horizontal_list_size = 0; - gfx_display_t *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; - gfx_animation_t *p_anim = anim_get_ptr(); - - if (!ozone->draw_sidebar) - return; /* Initial ticker configuration */ if (use_smooth_ticker) @@ -289,7 +286,9 @@ void ozone_draw_sidebar( /* Cursor */ if (ozone->cursor_in_sidebar) - ozone_draw_cursor(ozone, + ozone_draw_cursor( + ozone, + p_disp, userdata, video_width, video_height, @@ -302,6 +301,7 @@ void ozone_draw_sidebar( if (ozone->cursor_in_sidebar_old) ozone_draw_cursor( ozone, + p_disp, userdata, video_width, video_height, @@ -331,6 +331,7 @@ void ozone_draw_sidebar( /* Icon */ ozone_draw_icon( + p_disp, userdata, video_width, video_height, @@ -412,6 +413,7 @@ void ozone_draw_sidebar( /* Icon */ ozone_draw_icon( + p_disp, userdata, video_width, video_height,