(Ozone) Cleanups

This commit is contained in:
twinaphex 2020-03-09 15:03:21 +01:00
parent 92054bcd09
commit 448b988e62
4 changed files with 110 additions and 45 deletions

View File

@ -1475,7 +1475,12 @@ static void ozone_render(void *data,
gfx_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
}
static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_info)
static void ozone_draw_header(ozone_handle_t *ozone,
void *userdata,
unsigned video_width,
unsigned video_height,
bool battery_level_enable,
bool timedate_enable)
{
char title[255];
gfx_animation_ctx_ticker_t ticker;
@ -1491,11 +1496,6 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
unsigned seperator_margin = 30 * scale_factor;
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool battery_level_enable = video_info->battery_level_enable;
bool timedate_enable = video_info->timedate_enable;
/* Initial ticker configuration */
if (use_smooth_ticker)
@ -2093,6 +2093,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
bool video_fullscreen = video_info->fullscreen;
bool menu_mouse_enable = video_info->menu_mouse_enable;
bool input_menu_swap_ok_cancel_buttons = video_info->input_menu_swap_ok_cancel_buttons;
bool battery_level_enable = video_info->battery_level_enable;
bool timedate_enable = video_info->timedate_enable;
#if 0
static bool reset = false;
@ -2186,7 +2188,12 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
);
/* Header, footer */
ozone_draw_header(ozone, video_info);
ozone_draw_header(ozone,
userdata,
video_width,
video_height,
battery_level_enable,
timedate_enable);
ozone_draw_footer(ozone,
userdata,
video_width,
@ -2195,7 +2202,12 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
settings);
/* Sidebar */
ozone_draw_sidebar(ozone, video_info);
ozone_draw_sidebar(ozone,
userdata,
video_width,
video_height,
libretro_running,
menu_framebuffer_opacity);
/* Menu entries */
gfx_display_scissor_begin(userdata,

View File

@ -324,7 +324,14 @@ void ozone_draw_entries(
float scroll_y,
bool is_playlist);
void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info);
void ozone_draw_sidebar(
ozone_handle_t *ozone,
void *userdata,
unsigned video_width,
unsigned video_height,
bool libretro_running,
float menu_framebuffer_opacity
);
void ozone_change_tab(ozone_handle_t *ozone,
enum msg_hash_enums tab,

View File

@ -754,16 +754,15 @@ icons_iterate:
}
static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
video_frame_info_t *video_info,
void *userdata,
unsigned video_width,
unsigned video_height,
unsigned x_position,
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);
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
gfx_display_blend_begin(userdata);
ozone_draw_icon(
@ -793,12 +792,15 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
);
}
static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_handle_t *ozone,
unsigned *y, unsigned column_x, const char *text, unsigned lines_count)
static void ozone_content_metadata_line(
unsigned video_width,
unsigned video_height,
ozone_handle_t *ozone,
unsigned *y,
unsigned column_x,
const char *text,
unsigned lines_count)
{
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
ozone_draw_text(ozone,
text,
column_x,
@ -814,7 +816,8 @@ static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_ha
*y += (unsigned)(ozone->footer_font_glyph_height * (lines_count - 1)) + (unsigned)((float)ozone->footer_font_glyph_height * 1.5f);
}
void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_info)
void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
video_frame_info_t *video_info)
{
unsigned sidebar_width = ozone->dimensions.thumbnail_bar_width;
unsigned thumbnail_width = sidebar_width - (ozone->dimensions.sidebar_entry_icon_padding * 2);
@ -884,7 +887,12 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
* return immediately */
if (!show_right_thumbnail && !show_left_thumbnail && gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
{
ozone_draw_no_thumbnail_available(ozone, video_info, x_position, sidebar_width, 0);
ozone_draw_no_thumbnail_available(
ozone,
userdata,
video_width,
video_height,
x_position, sidebar_width, 0);
return;
}
@ -930,7 +938,13 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
* content metadata panel */
unsigned y_offset = thumbnail_height / 2;
ozone_draw_no_thumbnail_available(ozone, video_info, x_position, sidebar_width, y_offset);
ozone_draw_no_thumbnail_available(ozone,
userdata,
video_width,
video_height,
x_position,
sidebar_width,
y_offset);
}
/* Bottom row : "left" thumbnail or content metadata */
@ -1033,9 +1047,14 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
gfx_animation_ticker(&ticker);
}
ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x,
ticker_buf, 1);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
ticker_x_offset + column_x,
ticker_buf,
1);
/* Playtime
* Note: It is essentially impossible for this string
@ -1055,9 +1074,14 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
gfx_animation_ticker(&ticker);
}
ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x,
ticker_buf, 1);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
ticker_x_offset + column_x,
ticker_buf,
1);
/* Last played */
ticker_buf[0] = '\0';
@ -1073,26 +1097,46 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
gfx_animation_ticker(&ticker);
}
ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x,
ticker_buf, 1);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
ticker_x_offset + column_x,
ticker_buf,
1);
}
else
{
/* Core association */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_core_name, ozone->selection_core_name_lines);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
column_x,
ozone->selection_core_name,
ozone->selection_core_name_lines);
/* Playtime */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_playtime, 1);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
column_x,
ozone->selection_playtime,
1);
/* Last played */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_lastplayed, ozone->selection_lastplayed_lines);
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
column_x,
ozone->selection_lastplayed,
ozone->selection_lastplayed_lines);
}
}
}

View File

@ -103,7 +103,14 @@ unsigned ozone_system_tabs_icons[OZONE_SYSTEM_TAB_LAST] = {
OZONE_TAB_TEXTURE_SCAN_CONTENT
};
void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
void ozone_draw_sidebar(
ozone_handle_t *ozone,
void *userdata,
unsigned video_width,
unsigned video_height,
bool libretro_running,
float menu_framebuffer_opacity
)
{
size_t y;
int entry_width;
@ -120,11 +127,6 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
float scale_factor = ozone->last_scale_factor;
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)settings->uints.menu_ticker_type;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool libretro_running = video_info->libretro_running;
float menu_framebuffer_opacity = video_info->menu_framebuffer_opacity;
/* Initial ticker configuration */
if (use_smooth_ticker)