Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Ozone) Thumbnail related fixes #15810

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 23 additions & 43 deletions menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,7 @@ typedef struct ozone_theme
float *sidebar_top_gradient;
float *sidebar_bottom_gradient;

/*
Fancy cursor colors
*/
/* Fancy cursor colors */
float *cursor_border_0;
float *cursor_border_1;

Expand Down Expand Up @@ -3366,8 +3364,8 @@ static void ozone_draw_sidebar(
for (i = 0; i < (unsigned)(ozone->system_tab_end + 1); i++)
{
float *col = NULL;
bool selected = (ozone->categories_selection_ptr == i);
unsigned icon = ozone_system_tabs_icons[ozone->tabs[i]];
bool selected = (ozone->categories_selection_ptr == i);
unsigned icon = ozone_system_tabs_icons[ozone->tabs[i]];

if (!(col = selected ? ozone->theme->text_selected : ozone->theme->entries_icon))
col = ozone->pure_white;
Expand Down Expand Up @@ -3768,8 +3766,6 @@ static void ozone_entries_update_thumbnail_bar(
{
if (allow_animation)
{
ozone->show_thumbnail_bar = true;

entry.cb = NULL;
entry.userdata = NULL;
entry.target_value = ozone->dimensions.thumbnail_bar_width;
Expand All @@ -3780,9 +3776,9 @@ static void ozone_entries_update_thumbnail_bar(
{
ozone->animations.thumbnail_bar_position
= ozone->dimensions.thumbnail_bar_width;
ozone->show_thumbnail_bar = true;
}

ozone->show_thumbnail_bar = true;
ozone->flags &= ~OZONE_FLAG_PENDING_HIDE_THUMBNAIL_BAR;

/* Want thumbnails to load instantly when thumbnail
Expand Down Expand Up @@ -7164,20 +7160,6 @@ static void ozone_draw_fullscreen_thumbnails(
&& (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS))
goto error;

/* Safety check: ensure that current
* selection matches the entry selected when
* fullscreen thumbnails were enabled
* > Note that we exclude this check if we are
* currently viewing the quick menu and the
* thumbnail view is fading out. This enables
* a smooth transition if the user presses
* RetroPad A or keyboard 'return' to enter the
* quick menu while fullscreen thumbnails are
* being displayed */
if (((size_t)ozone->selection != ozone->fullscreen_thumbnail_selection) &&
((!(ozone->is_quick_menu)) || (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)))
goto error;

/* Sanity check: Return immediately if the view
* width/height is < 1 */
if ((view_width < 1) || (view_height < 1))
Expand All @@ -7202,11 +7184,10 @@ static void ozone_draw_fullscreen_thumbnails(
num_thumbnails++;

/* Prevent screen flashing when browsing in fullscreen thumbnail mode */
if ( (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
&& (num_thumbnails < 1)
if ( (num_thumbnails < 1)
&& (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS)
&& ( (right_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)
&& (left_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)))
&& ( (right_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)
&& (left_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)))
{
/* Darken background */
gfx_display_draw_quad(
Expand Down Expand Up @@ -7505,7 +7486,8 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
case OZONE_SYSTEM_TAB_VIDEO:
#endif
case OZONE_SYSTEM_TAB_MUSIC:
ozone->flags &= ~OZONE_FLAG_WANT_THUMBNAIL_BAR;
if (ozone->categories_selection_ptr <= ozone->system_tab_end)
ozone->flags &= ~OZONE_FLAG_WANT_THUMBNAIL_BAR;
break;

default:
Expand Down Expand Up @@ -8327,6 +8309,7 @@ static enum menu_action ozone_parse_menu_entry_action(
{
ozone->pending_cursor_in_sidebar = false;
ozone->flags |= OZONE_FLAG_CURSOR_IN_SIDEBAR;
ozone_sidebar_goto(ozone, ozone->categories_selection_ptr);
}
break;

Expand Down Expand Up @@ -9766,10 +9749,10 @@ static void ozone_render(void *data,
width, height, false, false);
thumbnail_scale_factor = settings->floats.ozone_thumbnail_scale_factor;

if ((scale_factor != ozone->last_scale_factor) ||
(thumbnail_scale_factor != ozone->last_thumbnail_scale_factor) ||
(width != ozone->last_width) ||
(height != ozone->last_height))
if ( (scale_factor != ozone->last_scale_factor)
|| (thumbnail_scale_factor != ozone->last_thumbnail_scale_factor)
|| (width != ozone->last_width)
|| (height != ozone->last_height))
{
ozone->last_scale_factor = scale_factor;
ozone->last_thumbnail_scale_factor = thumbnail_scale_factor;
Expand Down Expand Up @@ -11244,7 +11227,8 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
gfx_thumbnail_set_content(menu_st->thumbnail_path_data, NULL);
ozone_unload_thumbnail_textures(ozone);
update_thumbnails = true;
ozone->flags &= ~OZONE_FLAG_WANT_THUMBNAIL_BAR;
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE);
}
}

Expand Down Expand Up @@ -11355,15 +11339,10 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
}
}

if ( ((ozone->flags & OZONE_FLAG_IS_PLAYLIST) || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT))
&& (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
&& (size_t)ozone->selection != ozone->fullscreen_thumbnail_selection)
{
ozone->flags |= OZONE_FLAG_NEED_COMPUTE;
ozone_show_fullscreen_thumbnails(ozone);
}
else if ( (!(ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS))
&& (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS))
if ( ( (size_t)ozone->selection != ozone->fullscreen_thumbnail_selection
&& (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS))
|| ( (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS)
&& !(ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)))
{
ozone->flags |= OZONE_FLAG_NEED_COMPUTE;
ozone_show_fullscreen_thumbnails(ozone);
Expand Down Expand Up @@ -12063,8 +12042,9 @@ static void ozone_populate_entries(
case OZONE_SYSTEM_TAB_VIDEO:
#endif
case OZONE_SYSTEM_TAB_MUSIC:
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE);
if (ozone->categories_selection_ptr <= ozone->system_tab_end)
ozone->flags &= ~(OZONE_FLAG_WANT_THUMBNAIL_BAR
| OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE);
break;
}

Expand Down