(Menu) Cleanups

This commit is contained in:
twinaphex 2020-03-09 00:58:04 +01:00
parent ba73bebf3d
commit 2413c1b8d5
5 changed files with 105 additions and 76 deletions

View File

@ -1720,8 +1720,11 @@ static void materialui_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
math_matrix_4x4 mymat;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation;
@ -1730,7 +1733,7 @@ static void materialui_draw_icon(
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
coords.vertices = 4;
coords.vertex = NULL;
@ -1750,9 +1753,9 @@ static void materialui_draw_icon(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_blend_end(video_info->userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
gfx_display_blend_end(userdata);
}
static void materialui_draw_thumbnail(
@ -3505,6 +3508,7 @@ static void materialui_render_background(materialui_handle_t *mui, video_frame_i
1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f
};
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
bool libretro_running = video_info->libretro_running;
@ -3554,12 +3558,12 @@ static void materialui_render_background(materialui_handle_t *mui, video_frame_i
}
/* Draw background */
gfx_display_blend_begin(video_info->userdata);
gfx_display_draw_bg(&draw, video_info->userdata,
gfx_display_blend_begin(userdata);
gfx_display_draw_bg(&draw, userdata,
add_opacity, opacity_override);
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_blend_end(video_info->userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
gfx_display_blend_end(userdata);
}
static void materialui_render_landscape_border(

View File

@ -1552,7 +1552,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_draw_text(ozone, title, ticker_x_offset + 128 * scale_factor, ozone->dimensions.header_height / 2 + ozone->title_font_glyph_height * 3.0f/10.0f, TEXT_ALIGN_LEFT, video_width, video_height, ozone->fonts.title, ozone->theme->text_rgba, false);
/* Icon */
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
#if 0
if (discord_avatar_is_ready())
ozone_draw_icon(
@ -1577,7 +1577,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
/* Battery */
if (battery_level_enable)
@ -1598,7 +1598,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_draw_text(ozone, msg, video_width - 85 * scale_factor, ozone->dimensions.header_height / 2 + ozone->time_font_glyph_height * 3.0f/10.0f, TEXT_ALIGN_RIGHT, video_width, video_height, ozone->fonts.time, ozone->theme->text_rgba, false);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
ozone_draw_icon(
video_info,
status_icon_size,
@ -1609,7 +1609,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
}
@ -1629,7 +1629,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_draw_text(ozone, timedate, video_width - (85 * scale_factor) - timedate_offset, ozone->dimensions.header_height / 2 + ozone->time_font_glyph_height * 3.0f/10.0f, TEXT_ALIGN_RIGHT, video_width, video_height, ozone->fonts.time, ozone->theme->text_rgba, false);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
ozone_draw_icon(
video_info,
status_icon_size,
@ -1640,7 +1640,7 @@ static void ozone_draw_header(ozone_handle_t *ozone, video_frame_info_t *video_i
video_width,
video_height,
0, 1, ozone->theme->entries_icon);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
}
@ -1692,7 +1692,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
ok_width = 215 * scale_factor;
}
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
gfx_display_set_alpha(ozone->theme_dynamic.entries_icon, 1.0f);
@ -1712,7 +1712,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
if (ozone->is_playlist && !ozone->cursor_in_sidebar)
ozone_draw_icon(video_info, icon_size, icon_size, ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_L], video_width - (384 + 118 + 100 + 50) * scale_factor, video_height - ozone->dimensions.footer_height / 2 - icon_offset, video_width, video_height, 0, 1, ozone->theme_dynamic.entries_icon);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
ozone_draw_text(ozone,
do_swap ?
@ -1736,7 +1736,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
}
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
void ozone_update_content_metadata(ozone_handle_t *ozone)
@ -2144,8 +2144,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
ozone_draw_sidebar(ozone, video_info);
/* Menu entries */
gfx_display_scissor_begin(video_info->userdata,
video_info->width, video_info->height,
gfx_display_scissor_begin(userdata,
video_width,
video_height,
ozone->sidebar_offset + (unsigned) ozone->dimensions.sidebar_width,
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
video_width - (unsigned) ozone->dimensions.sidebar_width + (-ozone->sidebar_offset),
@ -2178,8 +2179,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
if (ozone->show_thumbnail_bar)
ozone_draw_thumbnail_bar(ozone, video_info);
gfx_display_scissor_end(video_info->userdata, video_info->width,
video_info->height);
gfx_display_scissor_end(userdata,
video_width,
video_height);
/* Flush first layer of text */
font_driver_flush(video_width, video_height, ozone->fonts.footer);

View File

@ -121,19 +121,20 @@ static void ozone_draw_cursor_slice(ozone_handle_t *ozone,
int slice_y = (int)y + 8 * scale_factor;
unsigned slice_new_w = width + (3 + 28 - 4) * scale_factor;
unsigned slice_new_h = height + 20 * scale_factor;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
gfx_display_set_alpha(ozone->theme_dynamic.cursor_alpha, alpha);
gfx_display_set_alpha(ozone->theme_dynamic.cursor_border, alpha);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
/* Cursor without border */
gfx_display_draw_texture_slice(
video_info->userdata,
video_info->width,
video_info->height,
userdata,
video_width,
video_height,
slice_x,
slice_y,
80, 80,
@ -147,9 +148,9 @@ static void ozone_draw_cursor_slice(ozone_handle_t *ozone,
/* Tainted border */
gfx_display_draw_texture_slice(
video_info->userdata,
video_info->width,
video_info->height,
userdata,
video_width,
video_height,
slice_x,
slice_y,
80, 80,
@ -161,7 +162,7 @@ static void ozone_draw_cursor_slice(ozone_handle_t *ozone,
ozone->textures[OZONE_TEXTURE_CURSOR_BORDER]
);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
static void ozone_draw_cursor_fallback(ozone_handle_t *ozone,
@ -271,6 +272,9 @@ void ozone_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
math_matrix_4x4 mymat;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = rotation;
@ -279,7 +283,7 @@ void ozone_draw_icon(
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
coords.vertices = 4;
coords.vertex = NULL;
@ -299,8 +303,8 @@ void ozone_draw_icon(
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_draw(&draw, userdata,
video_width, video_height);
}
void ozone_draw_backdrop(video_frame_info_t *video_info, float alpha)
@ -490,6 +494,9 @@ void ozone_draw_messagebox(ozone_handle_t *ozone,
struct string_list *list = !string_is_empty(message)
? string_split(message, "\n") : NULL;
float scale_factor = ozone->last_scale_factor;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (!list || !ozone || !ozone->fonts.footer)
{
@ -524,7 +531,7 @@ void ozone_draw_messagebox(ozone_handle_t *ozone,
gfx_display_set_alpha(ozone->theme_dynamic.message_background, ozone->animations.messagebox_alpha);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
if (ozone->has_all_assets) /* avoid drawing a black box if there's no assets */
{
@ -533,9 +540,9 @@ void ozone_draw_messagebox(ozone_handle_t *ozone,
unsigned slice_new_h = ozone->footer_font_glyph_height * (list->size + 2);
gfx_display_draw_texture_slice(
video_info->userdata,
video_info->width,
video_info->height,
userdata,
video_width,
video_height,
slice_x,
y,
256, 256,

View File

@ -154,9 +154,12 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
if (ozone->horizontal_list)
horizontal_list_size = (unsigned)ozone->horizontal_list->size;
gfx_display_scissor_begin(video_info->userdata,
video_info->width, video_info->height,
0, ozone->dimensions.header_height + ozone->dimensions.spacer_1px, (unsigned) ozone->dimensions.sidebar_width, video_height - ozone->dimensions.header_height - ozone->dimensions.footer_height - ozone->dimensions.spacer_1px);
gfx_display_scissor_begin(userdata,
video_width, video_height,
0,
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
(unsigned) ozone->dimensions.sidebar_width,
video_height - ozone->dimensions.header_height - ozone->dimensions.footer_height - ozone->dimensions.spacer_1px);
/* Background */
sidebar_height = video_height - ozone->dimensions.header_height - ozone->dimensions.sidebar_gradient_height * 2 - ozone->dimensions.footer_height;
@ -233,7 +236,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
/* Menu tabs */
y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.sidebar_padding_vertical;
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
for (i = 0; i < (unsigned)(ozone->system_tab_end+1); i++)
{
@ -260,7 +263,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
y += ozone->dimensions.sidebar_entry_height + ozone->dimensions.sidebar_entry_padding_vertical;
}
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
/* Console tabs */
if (horizontal_list_size > 0)
@ -279,7 +282,7 @@ void ozone_draw_sidebar(ozone_handle_t *ozone, video_frame_info_t *video_info)
y += ozone->dimensions.sidebar_entry_padding_vertical + ozone->dimensions.spacer_1px;
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
for (i = 0; i < horizontal_list_size; i++)
{
@ -333,14 +336,14 @@ console_iterate:
y += ozone->dimensions.sidebar_entry_height + ozone->dimensions.sidebar_entry_padding_vertical;
}
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
font_driver_flush(video_width, video_height, ozone->fonts.sidebar);
ozone->raster_blocks.sidebar.carr.coords.vertices = 0;
gfx_display_scissor_end(video_info->userdata, video_info->width,
video_info->height);
gfx_display_scissor_end(userdata, video_width,
video_height);
}
void ozone_go_to_sidebar(ozone_handle_t *ozone, uintptr_t tag)

View File

@ -575,6 +575,9 @@ static void stripes_draw_icon(
gfx_display_ctx_draw_t draw;
struct video_coords coords;
bool xmb_shadows_enable = video_info->xmb_shadows_enable;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (
(x < (-icon_size / 2.0f)) ||
@ -618,8 +621,8 @@ static void stripes_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_draw(&draw, userdata,
video_width, video_height);
}
coords.color = (const float*)color;
@ -633,8 +636,8 @@ static void stripes_draw_icon(
draw.y = draw.y + (icon_size-draw.width)/2;
}
#endif
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_draw(&draw, userdata,
video_width, video_height);
}
static void stripes_draw_text(
@ -727,7 +730,7 @@ static void stripes_render_keyboard(
{
uintptr_t texture = stripes->textures.list[STRIPES_TEXTURE_KEY_HOVER];
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
gfx_display_draw_texture(
video_info,
@ -738,7 +741,7 @@ static void stripes_render_keyboard(
&white[0],
texture);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
gfx_display_draw_text(stripes->font, grid[i],
@ -786,6 +789,7 @@ static void stripes_render_messagebox_internal(
unsigned i, y_position;
int x, y, longest = 0, longest_width = 0;
float line_height = 0;
void *userdata = video_info->userdata;
unsigned width = video_info->width;
unsigned height = video_info->height;
struct string_list *list = !string_is_empty(message)
@ -824,12 +828,12 @@ static void stripes_render_messagebox_internal(
}
}
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
gfx_display_draw_texture_slice(
video_info->userdata,
video_info->width,
video_info->height,
userdata,
video_width,
video_height,
x - longest_width/2 - stripes->margins_dialog,
y + stripes->margins_slice - stripes->margins_dialog,
256, 256,
@ -2353,6 +2357,9 @@ static int stripes_draw_item(
stripes_node_t * node = (stripes_node_t*)
file_list_get_userdata_at_offset(list, i);
settings_t *settings = config_get_ptr();
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
/* Initial ticker configuration */
ticker.type_enum = settings->uints.menu_ticker_type;
@ -2543,7 +2550,7 @@ static int stripes_draw_item(
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
stripes_draw_icon(video_info,
stripes->icon_size,
@ -2600,6 +2607,7 @@ static void stripes_draw_items(
size_t end = 0;
const char *thumb_ident = stripes_thumbnails_ident('R');
const char *left_thumb_ident= stripes_thumbnails_ident('L');
void *userdata = video_info->userdata;
if (!list || !list->size || !stripes)
return;
@ -2617,7 +2625,7 @@ static void stripes_draw_items(
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
@ -2637,7 +2645,7 @@ static void stripes_draw_items(
stripes_calculate_visible_range(stripes, height, end, current, &first, &last);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
for (i = first; i <= last; i++)
{
@ -2656,7 +2664,7 @@ static void stripes_draw_items(
break;
}
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
}
static void stripes_render(void *data,
@ -2726,9 +2734,11 @@ static void stripes_draw_bg(
{
gfx_display_ctx_draw_t draw;
struct video_coords coords;
float rgb[3];
HSLToRGB(0.0,0.5,0.5, &rgb[0]) ;
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
HSLToRGB(0.0,0.5,0.5, &rgb[0]);
float color[16] = {
rgb[0], rgb[1], rgb[2], 1,
rgb[0], rgb[1], rgb[2], 1,
@ -2752,10 +2762,10 @@ static void stripes_draw_bg(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
gfx_display_blend_begin(video_info->userdata);
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_begin(userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
gfx_display_blend_end(userdata);
}
static void stripes_draw_dark_layer(
@ -2772,6 +2782,9 @@ static void stripes_draw_dark_layer(
0, 0, 0, 1,
0, 0, 0, 1,
};
void *userdata = video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
gfx_display_set_alpha(black, MIN(stripes->alpha, 0.75));
@ -2791,10 +2804,10 @@ static void stripes_draw_dark_layer(
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline.id = 0;
gfx_display_blend_begin(video_info->userdata);
gfx_display_draw(&draw, video_info->userdata,
video_info->width, video_info->height);
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_begin(userdata);
gfx_display_draw(&draw, userdata,
video_width, video_height);
gfx_display_blend_end(userdata);
}
static void stripes_frame(void *data, video_frame_info_t *video_info)
@ -2856,8 +2869,8 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_blend_begin(video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
gfx_display_blend_begin(userdata);
/* Horizontal stripes */
for (i = 0; i <= stripes_list_get_size(stripes, MENU_LIST_HORIZONTAL)
@ -2892,7 +2905,7 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
video_width, video_height,
&color[0]);
gfx_display_blend_begin(video_info->userdata);
gfx_display_blend_begin(userdata);
stack_width += node->width;
}
@ -2928,7 +2941,7 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
gfx_display_rotate_z(&rotate_draw, video_info->userdata);
gfx_display_rotate_z(&rotate_draw, userdata);
stripes_draw_icon(video_info,
stripes->icon_size,
@ -2948,7 +2961,7 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
stack_width += node->width;
}
gfx_display_blend_end(video_info->userdata);
gfx_display_blend_end(userdata);
/* Vertical icons */
#if 0