mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Don't call gfx_display_rotate_z unless the display driver implementation's
'handles_transform' is set to false
This commit is contained in:
parent
1798651041
commit
336ca1a68c
@ -959,32 +959,30 @@ 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)
|
||||
{
|
||||
float cosine, sine, radians;
|
||||
static math_matrix_4x4 matrix_rotated = {
|
||||
float cosine, sine;
|
||||
static math_matrix_4x4 rot = {
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f ,
|
||||
0.0f, 0.0f, 0.0f, 0.0f ,
|
||||
0.0f, 0.0f, 1.0f, 0.0f ,
|
||||
0.0f, 0.0f, 0.0f, 1.0f }
|
||||
};
|
||||
math_matrix_4x4 *b = NULL;
|
||||
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
||||
math_matrix_4x4 *b = (dispctx->get_default_mvp)
|
||||
? (math_matrix_4x4*)dispctx->get_default_mvp(data)
|
||||
: NULL;
|
||||
float radians = draw->rotation;
|
||||
|
||||
if (
|
||||
dispctx->handles_transform
|
||||
|| !dispctx->get_default_mvp
|
||||
|| !(b = (math_matrix_4x4*)dispctx->get_default_mvp(data))
|
||||
)
|
||||
if (!b)
|
||||
return;
|
||||
|
||||
radians = draw->rotation;
|
||||
cosine = cosf(radians);
|
||||
sine = sinf(radians);
|
||||
MAT_ELEM_4X4(matrix_rotated, 0, 0) = cosine;
|
||||
MAT_ELEM_4X4(matrix_rotated, 0, 1) = -sine;
|
||||
MAT_ELEM_4X4(matrix_rotated, 1, 0) = sine;
|
||||
MAT_ELEM_4X4(matrix_rotated, 1, 1) = cosine;
|
||||
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, matrix_rotated, *b);
|
||||
matrix_4x4_multiply(*draw->matrix, rot, *b);
|
||||
|
||||
if (draw->scale_enable)
|
||||
{
|
||||
@ -1128,20 +1126,12 @@ void gfx_display_draw_keyboard(
|
||||
0.00, 0.00, 0.00, 0.85,
|
||||
};
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
|
||||
#ifdef HAVE_MIST
|
||||
if(steam_has_osk_open())
|
||||
return;
|
||||
#endif
|
||||
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_draw_quad(
|
||||
p_disp,
|
||||
userdata,
|
||||
@ -1162,7 +1152,18 @@ void gfx_display_draw_keyboard(
|
||||
if (ptr_width >= ptr_height)
|
||||
ptr_width = ptr_height;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
for (i = 0; i < 44; i++)
|
||||
{
|
||||
|
@ -881,7 +881,6 @@ void gfx_thumbnail_draw(
|
||||
/* Only draw thumbnail if it is available... */
|
||||
if (thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
gfx_display_ctx_draw_t draw;
|
||||
struct video_coords coords;
|
||||
math_matrix_4x4 mymat;
|
||||
@ -911,25 +910,29 @@ void gfx_thumbnail_draw(
|
||||
if (dispctx->blend_begin)
|
||||
dispctx->blend_begin(userdata);
|
||||
|
||||
/* Perform 'rotation' step
|
||||
* > Note that rotation does not actually work...
|
||||
* > It rotates the image all right, but distorts it
|
||||
* to fit the aspect of the bounding box while clipping
|
||||
* off any 'corners' that extend beyond the bounding box
|
||||
* > Since the result is visual garbage, we disable
|
||||
* rotation entirely
|
||||
* > But we still have to call gfx_display_rotate_z(),
|
||||
* or nothing will be drawn...
|
||||
* Note that we also disable scaling here (scale_enable),
|
||||
* since we handle scaling internally... */
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
/* Perform 'rotation' step
|
||||
* > Note that rotation does not actually work...
|
||||
* > It rotates the image all right, but distorts it
|
||||
* to fit the aspect of the bounding box while clipping
|
||||
* off any 'corners' that extend beyond the bounding box
|
||||
* > Since the result is visual garbage, we disable
|
||||
* rotation entirely
|
||||
* > But we still have to call gfx_display_rotate_z(),
|
||||
* or nothing will be drawn...
|
||||
* Note that we also disable scaling here (scale_enable),
|
||||
* since we handle scaling internally... */
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
/* Configure draw object
|
||||
* > Note: Colour, width/height and position must
|
||||
|
@ -612,7 +612,6 @@ void gfx_widgets_draw_icon(
|
||||
float rotation,
|
||||
float *color)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
gfx_display_ctx_draw_t draw;
|
||||
struct video_coords coords;
|
||||
math_matrix_4x4 mymat;
|
||||
@ -622,14 +621,18 @@ void gfx_widgets_draw_icon(
|
||||
if (!texture)
|
||||
return;
|
||||
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = rotation;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = rotation;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = NULL;
|
||||
|
@ -3983,7 +3983,6 @@ static void materialui_render_menu_entry_default(
|
||||
int x_offset)
|
||||
{
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
const char *entry_value = NULL;
|
||||
const char *entry_label = NULL;
|
||||
unsigned entry_type = 0;
|
||||
@ -4001,7 +4000,9 @@ static void materialui_render_menu_entry_default(
|
||||
bool draw_text_outside = (x_offset != 0);
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
@ -4343,7 +4344,6 @@ static void materialui_render_menu_entry_playlist_list(
|
||||
{
|
||||
bool draw_divider;
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
const char *entry_label = NULL;
|
||||
int entry_x = x_offset + node->x;
|
||||
int entry_y = header_height - mui->scroll_y + node->y;
|
||||
@ -4355,7 +4355,9 @@ static void materialui_render_menu_entry_playlist_list(
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
@ -4595,7 +4597,6 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
int x_offset)
|
||||
{
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
const char *entry_label = NULL;
|
||||
float entry_x = (float)x_offset + node->x;
|
||||
float entry_y = (float)header_height - mui->scroll_y + node->y;
|
||||
@ -4615,7 +4616,9 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
@ -4890,7 +4893,6 @@ static void materialui_render_selected_entry_aux_playlist_desktop(
|
||||
file_list_t *list, size_t selection)
|
||||
{
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
materialui_node_t *node = (materialui_node_t*)list->list[selection].userdata;
|
||||
float background_x = (float)(x_offset + (int)mui->landscape_optimization.border_width);
|
||||
float background_y = (float)header_height;
|
||||
@ -4913,7 +4915,9 @@ static void materialui_render_selected_entry_aux_playlist_desktop(
|
||||
(background_height <= 0))
|
||||
return;
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
@ -6911,7 +6915,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
int list_x_offset;
|
||||
math_matrix_4x4 mymat;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
materialui_handle_t *mui = (materialui_handle_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
gfx_display_t *p_disp = disp_get_ptr();
|
||||
@ -6945,14 +6948,18 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
||||
return;
|
||||
}
|
||||
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0.0f;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
video_driver_set_viewport(video_width, video_height, true, false);
|
||||
|
||||
|
@ -9940,6 +9940,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
|
||||
background_color,
|
||||
NULL);
|
||||
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
|
@ -3628,7 +3628,6 @@ static int xmb_draw_item(
|
||||
)
|
||||
{
|
||||
math_matrix_4x4 mymat_tmp;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,
|
||||
entry.enum_idx, entry.path, entry.label,
|
||||
entry_type, (i == current), entry.checked);
|
||||
@ -3674,14 +3673,18 @@ static int xmb_draw_item(
|
||||
}
|
||||
}
|
||||
|
||||
rotate_draw.matrix = &mymat_tmp;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = scale_factor;
|
||||
rotate_draw.scale_y = scale_factor;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = (scale_factor == 1.0f) ? false : true;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat_tmp;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = scale_factor;
|
||||
rotate_draw.scale_y = scale_factor;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = (scale_factor == 1.0f) ? false : true;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
xmb_draw_icon(
|
||||
userdata,
|
||||
@ -5027,7 +5030,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
{
|
||||
math_matrix_4x4 mymat;
|
||||
unsigned i;
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
char msg[1024];
|
||||
char title_msg[255];
|
||||
char title_truncated[255];
|
||||
@ -5184,14 +5186,18 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
video_width, video_height, xmb->font);
|
||||
}
|
||||
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = 1.0f;
|
||||
rotate_draw.scale_y = 1.0f;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = false;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
/**************************/
|
||||
/* Draw thumbnails: START */
|
||||
@ -5571,7 +5577,6 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
if (xmb_item_color[3] != 0)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
math_matrix_4x4 mymat_tmp;
|
||||
uintptr_t texture = node->icon;
|
||||
float x = xmb->x + xmb->categories_x_pos +
|
||||
@ -5603,14 +5608,18 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
|
||||
}
|
||||
}
|
||||
|
||||
rotate_draw.matrix = &mymat_tmp;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = scale_factor;
|
||||
rotate_draw.scale_y = scale_factor;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = (scale_factor == 1.0f) ? false : true;
|
||||
if (!p_disp->dispctx->handles_transform)
|
||||
{
|
||||
gfx_display_ctx_rotate_draw_t rotate_draw;
|
||||
rotate_draw.matrix = &mymat_tmp;
|
||||
rotate_draw.rotation = 0;
|
||||
rotate_draw.scale_x = scale_factor;
|
||||
rotate_draw.scale_y = scale_factor;
|
||||
rotate_draw.scale_z = 1.0f;
|
||||
rotate_draw.scale_enable = (scale_factor == 1.0f) ? false : true;
|
||||
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
|
||||
}
|
||||
|
||||
xmb_draw_icon(
|
||||
userdata,
|
||||
|
Loading…
x
Reference in New Issue
Block a user