From 135b95808c32b77706d11cff363da7901d916c27 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 30 May 2025 12:54:47 +0300 Subject: [PATCH] shared: fix matrix type computations When I changed the weston_matrix implementation to linalg-4.h, I broke the type computations: they were getting reset instead of accumulated. This manifested with the desktop-shell feature where one can arbitrarily rotate the windows. A rotated window triggered an incorrect matrix type, which then did not ignore the surface opaque region as it should have. That caused rendering artifacts on all renderers. Fixes: 3fefb5ba4468c7995abd3c4e878c526e386b224e Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1031 Signed-off-by: Pekka Paalanen --- shared/matrix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/matrix.c b/shared/matrix.c index 9d1819cbb..8e21bf4b7 100644 --- a/shared/matrix.c +++ b/shared/matrix.c @@ -64,21 +64,21 @@ WL_EXPORT void weston_matrix_translate(struct weston_matrix *matrix, float x, float y, float z) { matrix->M = weston_m4f_mul_m4f(weston_m4f_translation(x, y, z), matrix->M); - matrix->type = WESTON_MATRIX_TRANSFORM_TRANSLATE; + matrix->type |= WESTON_MATRIX_TRANSFORM_TRANSLATE; } WL_EXPORT void weston_matrix_scale(struct weston_matrix *matrix, float x, float y,float z) { matrix->M = weston_m4f_mul_m4f(weston_m4f_scaling(x, y, z), matrix->M); - matrix->type = WESTON_MATRIX_TRANSFORM_SCALE; + matrix->type |= WESTON_MATRIX_TRANSFORM_SCALE; } WL_EXPORT void weston_matrix_rotate_xy(struct weston_matrix *matrix, float cos, float sin) { matrix->M = weston_m4f_mul_m4f(weston_m4f_rotation_xy(cos, sin), matrix->M); - matrix->type = WESTON_MATRIX_TRANSFORM_ROTATE; + matrix->type |= WESTON_MATRIX_TRANSFORM_ROTATE; } /* v <- m * v */