[PATCH 1/2] compositor: Make sure surface->transform.matrix, inverse are always valid

Kristian Høgsberg krh at bitplanet.net
Tue Feb 19 14:04:50 PST 2013


First step towards getting rid of the transform.enabled optimization.
---
 src/compositor.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 64d0830..07b95a9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -520,6 +520,17 @@ weston_surface_update_transform_disable(struct weston_surface *surface)
 	surface->geometry.x = roundf(surface->geometry.x);
 	surface->geometry.y = roundf(surface->geometry.y);
 
+	/* 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;
+
+	surface->transform.matrix = surface->transform.position.matrix;
+
+	surface->transform.inverse.type  = WESTON_MATRIX_TRANSFORM_TRANSLATE;
+	surface->transform.inverse.d[12] = -surface->geometry.x;
+	surface->transform.inverse.d[13] = -surface->geometry.y;
+
 	pixman_region32_init_rect(&surface->transform.boundingbox,
 				  surface->geometry.x,
 				  surface->geometry.y,
-- 
1.8.1



More information about the wayland-devel mailing list