aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/drm.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-03-11 09:49:38 +0100
committerSimon Ser <contact@emersion.fr>2021-03-11 22:52:38 +0100
commit44fa2c4b49ced30a69e86a2ed78dd9bf62e0fbb3 (patch)
tree805046b08c734400d1f7c2dfd12c559812361a68 /backend/drm/drm.c
parent9601a2abf024fb8ac400c0df178bb41ec9e5d215 (diff)
output: fix transform matrix for 90/270 rotations
We need to adjust the second translation depending on the transform we applied. Fixes: 9601a2abf024 ("output: improve transform matrix calculation" Closes: https://github.com/swaywm/wlroots/issues/2774
Diffstat (limited to 'backend/drm/drm.c')
-rw-r--r--backend/drm/drm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index e06213fe..a74c9ca7 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -938,11 +938,17 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
float output_matrix[9];
wlr_matrix_identity(output_matrix);
if (output->transform != WL_OUTPUT_TRANSFORM_NORMAL) {
+ struct wlr_box tr_size = {
+ .width = plane->surf.width,
+ .height = plane->surf.height,
+ };
+ wlr_box_transform(&tr_size, &tr_size, output->transform, 0, 0);
+
wlr_matrix_translate(output_matrix, plane->surf.width / 2.0,
plane->surf.height / 2.0);
wlr_matrix_transform(output_matrix, output->transform);
- wlr_matrix_translate(output_matrix, - plane->surf.width / 2.0,
- - plane->surf.height / 2.0);
+ wlr_matrix_translate(output_matrix, - tr_size.width / 2.0,
+ - tr_size.height / 2.0);
}
float matrix[9];