diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index 8364ac0a50..92b5952d5f 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -957,7 +957,7 @@ void gfx_display_draw_texture_slice( } void gfx_display_rotate_z(gfx_display_t *p_disp, - gfx_display_ctx_rotate_draw_t *draw, void *data) + math_matrix_4x4 *matrix, float cosine, float sine, void *data) { gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; math_matrix_4x4 *b = (dispctx->get_default_mvp) @@ -971,14 +971,11 @@ void gfx_display_rotate_z(gfx_display_t *p_disp, 0.0f, 0.0f, 1.0f, 0.0f , 0.0f, 0.0f, 0.0f, 1.0f } }; - float radians = draw->rotation; - float cosine = cosf(radians); - float sine = sinf(radians); MAT_ELEM_4X4(rot, 0, 0) = cosine; MAT_ELEM_4X4(rot, 0, 1) = -sine; MAT_ELEM_4X4(rot, 1, 0) = sine; MAT_ELEM_4X4(rot, 1, 1) = cosine; - matrix_4x4_multiply(*draw->matrix, rot, *b); + matrix_4x4_multiply(*matrix, rot, *b); } } @@ -1137,11 +1134,9 @@ void gfx_display_draw_keyboard( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } for (i = 0; i < 44; i++) diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 6a78d64b4a..bdab76ada5 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -170,12 +170,6 @@ struct gfx_display_ctx_draw bool pipeline_active; }; -typedef struct gfx_display_ctx_rotate_draw -{ - math_matrix_4x4 *matrix; - float rotation; -} gfx_display_ctx_rotate_draw_t; - typedef struct gfx_display_ctx_coord_draw { const float *ptr; @@ -296,7 +290,7 @@ void gfx_display_draw_texture_slice( math_matrix_4x4 *mymat); void gfx_display_rotate_z(gfx_display_t *p_disp, - gfx_display_ctx_rotate_draw_t *draw, void *data); + math_matrix_4x4 *matrix, float cosine, float sine, void *data); font_data_t *gfx_display_font_file(gfx_display_t *p_disp, char* fontpath, float font_size, bool is_threaded); diff --git a/gfx/gfx_thumbnail.c b/gfx/gfx_thumbnail.c index 870cd3fbd3..38ad59b674 100644 --- a/gfx/gfx_thumbnail.c +++ b/gfx/gfx_thumbnail.c @@ -922,11 +922,9 @@ void gfx_thumbnail_draw( * > But we still have to call gfx_display_rotate_z(), * or nothing will be drawn... */ - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Configure draw object diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index 91b3349cdc..18973e0ca9 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -609,7 +609,7 @@ void gfx_widgets_draw_icon( unsigned icon_height, uintptr_t texture, float x, float y, - float rotation, + float radians, float *color) { gfx_display_ctx_draw_t draw; @@ -623,11 +623,9 @@ void gfx_widgets_draw_icon( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = rotation; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = cosf(radians); + float sine = sinf(radians); + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } coords.vertices = 4; @@ -641,7 +639,7 @@ void gfx_widgets_draw_icon( draw.width = icon_width; draw.height = icon_height; draw.scale_factor = 1.0f; - draw.rotation = rotation; + draw.rotation = radians; draw.coords = &coords; draw.matrix_data = &mymat; draw.texture = texture; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index fe0563aefe..2820da6702 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -4002,11 +4002,9 @@ static void materialui_render_menu_entry_default( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Initial ticker configuration @@ -4353,11 +4351,9 @@ static void materialui_render_menu_entry_playlist_list( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Initial ticker configuration @@ -4610,11 +4606,9 @@ static void materialui_render_menu_entry_playlist_dual_icon( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Initial ticker configuration @@ -4905,11 +4899,9 @@ static void materialui_render_selected_entry_aux_playlist_desktop( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Draw sidebar background @@ -6934,11 +6926,9 @@ static void materialui_frame(void *data, video_frame_info_t *video_info) if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } video_driver_set_viewport(video_width, video_height, true, false); diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 96872c31c6..981b8704a4 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -9942,11 +9942,9 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0.0f; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /* Header, footer */ diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index c56ecb37f9..b390ab0d98 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3675,11 +3675,9 @@ static int xmb_draw_item( if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat_tmp; - rotate_draw.rotation = 0; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat_tmp, cosine, sine, userdata); if (scale_factor != 1.0f) { @@ -5198,11 +5196,9 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat; - rotate_draw.rotation = 0; - - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ + gfx_display_rotate_z(p_disp, &mymat, cosine, sine, userdata); } /**************************/ @@ -5616,11 +5612,10 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) if (!p_disp->dispctx->handles_transform) { - gfx_display_ctx_rotate_draw_t rotate_draw; - rotate_draw.matrix = &mymat_tmp; - rotate_draw.rotation = 0; + float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */ + float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */ - gfx_display_rotate_z(p_disp, &rotate_draw, userdata); + gfx_display_rotate_z(p_disp, &mymat_tmp, cosine, sine, userdata); if (scale_factor != 1.0f) {