mirror of https://github.com/mpv-player/mpv
vo_dmabuf_wayland: assume counter-clockwise rotations
In practice, most compositors implement the rotation clockwise which matches mpv's option, but amusingly this is actually incorrect. According to the spec*, wayland buffer rotations are counter-clockwise. So with this assumption in mind, in order for the rotation to match mpv's usual semantics, the 90 degree and 270 degree positions need to be flipped. Of course, this will make the VO rotate the wrong way on most compositors, but this is what the spec says (sway master is known to currently be correct). Fixes #12508 (sort of but will break the rotation direction on other compositors. Oh well). *: https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-enum-transform
This commit is contained in:
parent
c19115c8da
commit
27ef1725e7
|
@ -677,7 +677,10 @@ done:
|
|||
if (!vo_wayland_reconfig(vo))
|
||||
return VO_ERROR;
|
||||
|
||||
wl_surface_set_buffer_transform(vo->wl->video_surface, img->params.rotate / 90);
|
||||
// mpv rotates clockwise but the wayland spec has counter-clockwise rotations
|
||||
// swap 1 and 3 to match mpv's direction
|
||||
int transform = (360 - img->params.rotate) % 360 / 90;
|
||||
wl_surface_set_buffer_transform(vo->wl->video_surface, transform);
|
||||
|
||||
// Immediately destroy all buffers if params change.
|
||||
destroy_buffers(vo);
|
||||
|
|
Loading…
Reference in New Issue