From 1ff024be2616b87a83d6e16bb36b1fdce309966a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 21 Sep 2021 21:38:07 +0200 Subject: [PATCH] Don't do rotate_z call for every draw_texture_slice call --- gfx/gfx_display.c | 16 ++++------------ gfx/gfx_display.h | 3 ++- menu/drivers/ozone.c | 36 ++++++++++++++++++++++++------------ menu/drivers/xmb.c | 8 +++++--- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index ed88e37510..ae81228cc4 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -622,12 +622,12 @@ void gfx_display_draw_texture_slice( int x, int y, unsigned w, unsigned h, unsigned new_w, unsigned new_h, unsigned width, unsigned height, - float *color, unsigned offset, float scale_factor, uintptr_t texture) + float *color, unsigned offset, float scale_factor, uintptr_t texture, + math_matrix_4x4 *mymat +) { gfx_display_ctx_draw_t draw; - gfx_display_ctx_rotate_draw_t rotate_draw; struct video_coords coords; - math_matrix_4x4 mymat; gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; float V_BL[2], V_BR[2], V_TL[2], V_TR[2], T_BL[2], T_BR[2], T_TL[2], T_TR[2]; @@ -725,12 +725,6 @@ void gfx_display_draw_texture_slice( T_TR[0] = tex_woff; T_TR[1] = 0.0f; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0; - rotate_draw.scale_x = 1.0; - rotate_draw.scale_y = 1.0; - rotate_draw.scale_z = 1; - rotate_draw.scale_enable = true; coords.vertices = 4; coords.vertex = vert_coord; coords.tex_coord = tex_coord; @@ -738,13 +732,11 @@ void gfx_display_draw_texture_slice( draw.width = width; draw.height = height; draw.coords = &coords; - draw.matrix_data = &mymat; + draw.matrix_data = mymat; draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline_id = 0; coords.color = (const float*)(color == NULL ? colors : color); - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); - draw.texture = texture; draw.x = 0; draw.y = 0; diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 26f3339aed..9804d231ef 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -303,7 +303,8 @@ void gfx_display_draw_texture_slice( int x, int y, unsigned w, unsigned h, unsigned new_w, unsigned new_h, unsigned width, unsigned height, - float *color, unsigned offset, float scale_factor, uintptr_t texture); + float *color, unsigned offset, float scale_factor, uintptr_t texture, + math_matrix_4x4 *mymat); void gfx_display_rotate_z(gfx_display_t *p_disp, gfx_display_ctx_rotate_draw_t *draw, void *data); diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 23ecace802..9219bbc4e8 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -2484,7 +2484,8 @@ static void ozone_draw_cursor_slice( unsigned video_height, int x_offset, unsigned width, unsigned height, - size_t y, float alpha) + size_t y, float alpha, + math_matrix_4x4 *mymat) { float scale_factor = ozone->last_scale_factor; int slice_x = x_offset - 12 * scale_factor; @@ -2520,7 +2521,8 @@ static void ozone_draw_cursor_slice( video_width, video_height, ozone->theme_dynamic.cursor_alpha, 20, scale_factor, - ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_NO_BORDER] + ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_NO_BORDER], + mymat ); /* Tainted border */ @@ -2537,7 +2539,8 @@ static void ozone_draw_cursor_slice( video_width, video_height, ozone->theme_dynamic.cursor_border, 20, scale_factor, - ozone->textures[OZONE_TEXTURE_CURSOR_BORDER] + ozone->textures[OZONE_TEXTURE_CURSOR_BORDER], + mymat ); if (dispctx && dispctx->blend_end) @@ -2650,7 +2653,8 @@ static void ozone_draw_cursor( unsigned video_height, int x_offset, unsigned width, unsigned height, - size_t y, float alpha) + size_t y, float alpha, + math_matrix_4x4 *mymat) { int new_x = x_offset; size_t new_y = y; @@ -2665,7 +2669,8 @@ static void ozone_draw_cursor( p_disp, userdata, video_width, video_height, - new_x, width, height, new_y, alpha); + new_x, width, height, new_y, alpha, + mymat); else ozone_draw_cursor_fallback(ozone, p_disp, @@ -2826,7 +2831,8 @@ static void ozone_draw_sidebar( entry_width - ozone->dimensions.spacer_5px, ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px, selection_y + ozone->animations.scroll_y_sidebar, - ozone->animations.cursor_alpha); + ozone->animations.cursor_alpha, + mymat); if (ozone->cursor_in_sidebar_old) ozone_draw_cursor( @@ -2839,7 +2845,8 @@ static void ozone_draw_sidebar( entry_width - ozone->dimensions.spacer_5px, ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px, selection_old_y + ozone->animations.scroll_y_sidebar, - 1-ozone->animations.cursor_alpha); + 1-ozone->animations.cursor_alpha, + mymat); /* Menu tabs */ y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.sidebar_padding_vertical; @@ -4520,7 +4527,8 @@ border_iterate: entry_width - ozone->dimensions.spacer_5px, button_height + ozone->dimensions.spacer_1px, selection_y + scroll_y, - ozone->animations.cursor_alpha * alpha); + ozone->animations.cursor_alpha * alpha, + mymat); /* Old*/ if (!ozone->cursor_in_sidebar_old) @@ -4539,7 +4547,8 @@ border_iterate: entry_width - ozone->dimensions.spacer_5px, button_height + ozone->dimensions.spacer_1px, old_selection_y + scroll_y, - (1-ozone->animations.cursor_alpha) * alpha); + (1-ozone->animations.cursor_alpha) * alpha, + mymat); /* Icons + text */ y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.entry_padding_vertical; @@ -5574,7 +5583,8 @@ static void ozone_draw_messagebox( void *userdata, unsigned video_width, unsigned video_height, - const char *message) + const char *message, + math_matrix_4x4 *mymat) { unsigned i, y_position; char wrapped_message[MENU_SUBLABEL_MAX_LENGTH]; @@ -5672,7 +5682,8 @@ static void ozone_draw_messagebox( width, height, ozone->theme_dynamic.message_background, 16, scale_factor, - ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE] + ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE], + mymat ); } @@ -9380,7 +9391,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) userdata, video_width, video_height, - ozone->pending_message); + ozone->pending_message, + &mymat); /* Flush second layer of text */ ozone_font_flush(video_width, video_height, &ozone->fonts.footer); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index c82e501e79..e494bebf1e 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -969,7 +969,8 @@ static void xmb_render_messagebox_internal( gfx_display_t *p_disp, unsigned video_width, unsigned video_height, - xmb_handle_t *xmb, const char *message) + xmb_handle_t *xmb, const char *message, + math_matrix_4x4 *mymat) { unsigned i, y_position; char wrapped_message[MENU_SUBLABEL_MAX_LENGTH]; @@ -1051,7 +1052,8 @@ static void xmb_render_messagebox_internal( video_width, video_height, NULL, xmb->margins_slice, xmb->last_scale_factor, - xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE]); + xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE], + mymat); for (i = 0; i < list.size; i++) { @@ -5454,7 +5456,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) userdata, video_width, video_height); xmb_render_messagebox_internal(userdata, p_disp, video_width, video_height, - xmb, msg); + xmb, msg, &mymat); } /* Cursor image */