matrix: track transform type

Introduce several matrix transform types and track type for matrix.
Could be usefull for activating some fastpath that depends on some
transform type.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
This commit is contained in:
Vasily Khoruzhick
2013-01-28 22:40:28 +03:00
committed by Kristian Høgsberg
parent 15336e8b5c
commit 1bbf372e31
4 changed files with 38 additions and 15 deletions
+3
View File
@@ -539,6 +539,7 @@ weston_surface_update_transform_enable(struct weston_surface *surface)
surface->transform.enabled = 1;
/* Otherwise identity matrix, but with x and y translation. */
surface->transform.position.matrix.type = WESTON_MATRIX_TRANSFORM_TRANSLATE;
surface->transform.position.matrix.d[12] = surface->geometry.x;
surface->transform.position.matrix.d[13] = surface->geometry.y;
@@ -2754,12 +2755,14 @@ weston_output_compute_transform(struct weston_output *output)
int flip;
weston_matrix_init(&transform);
transform.type = WESTON_MATRIX_TRANSFORM_ROTATE;
switch(output->transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
transform.type |= WESTON_MATRIX_TRANSFORM_OTHER;
flip = -1;
break;
default:
+5 -12
View File
@@ -1876,6 +1876,8 @@ shell_map_popup(struct shell_surface *shsurf)
} else {
/* construct x, y translation matrix */
weston_matrix_init(&shsurf->popup.parent_transform.matrix);
shsurf->popup.parent_transform.matrix.type =
WESTON_MATRIX_TRANSFORM_TRANSLATE;
shsurf->popup.parent_transform.matrix.d[12] =
parent->geometry.x;
shsurf->popup.parent_transform.matrix.d[13] =
@@ -2502,10 +2504,7 @@ rotate_grab_motion(struct wl_pointer_grab *grab,
&shsurf->rotation.transform.matrix;
weston_matrix_init(&rotate->rotation);
rotate->rotation.d[0] = dx / r;
rotate->rotation.d[4] = -dy / r;
rotate->rotation.d[1] = -rotate->rotation.d[4];
rotate->rotation.d[5] = rotate->rotation.d[0];
weston_matrix_rotate_xy(&rotate->rotation, dx / r, dy / r);
weston_matrix_init(matrix);
weston_matrix_translate(matrix, -cx, -cy, 0.0f);
@@ -2600,17 +2599,11 @@ rotate_binding(struct wl_seat *seat, uint32_t time, uint32_t button,
struct weston_matrix inverse;
weston_matrix_init(&inverse);
inverse.d[0] = dx / r;
inverse.d[4] = dy / r;
inverse.d[1] = -inverse.d[4];
inverse.d[5] = inverse.d[0];
weston_matrix_rotate_xy(&inverse, dx / r, -dy / r);
weston_matrix_multiply(&surface->rotation.rotation, &inverse);
weston_matrix_init(&rotate->rotation);
rotate->rotation.d[0] = dx / r;
rotate->rotation.d[4] = -dy / r;
rotate->rotation.d[1] = -rotate->rotation.d[4];
rotate->rotation.d[5] = rotate->rotation.d[0];
weston_matrix_rotate_xy(&rotate->rotation, dx / r, dy / r);
} else {
weston_matrix_init(&surface->rotation.rotation);
weston_matrix_init(&rotate->rotation);