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: 3fefb5ba44
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1031

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-05-30 12:54:47 +03:00 committed by Marius Vlad
parent a124b19a01
commit 135b95808c

View file

@ -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 */