[PATCH weston 1/4] compositor: update weston_surface:transform.matrix always

Pekka Paalanen ppaalanen at gmail.com
Tue Dec 18 03:58:47 PST 2012


Update the matrix always, regardless of transform.enabled. Will make it
easier to inherit a surface transform.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/compositor.c |    5 +++++
 src/compositor.h |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index e556766..0b37e63 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -514,6 +514,11 @@ 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. */
+	weston_matrix_init(&surface->transform.matrix);
+	surface->transform.matrix.d[12] = surface->geometry.x;
+	surface->transform.matrix.d[13] = surface->geometry.y;
+
 	pixman_region32_init_rect(&surface->transform.boundingbox,
 				  surface->geometry.x,
 				  surface->geometry.y,
diff --git a/src/compositor.h b/src/compositor.h
index 15d6939..1d790d3 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -415,8 +415,10 @@ struct weston_surface {
 		pixman_region32_t boundingbox;
 		pixman_region32_t opaque;
 
-		/* matrix and inverse are used only if enabled = 1.
-		 * If enabled = 0, use x, y, width, height directly.
+		/* 'inverse' is used only if enabled = 1.
+		 * 'matrix' can be used regardless of 'enabled', to allow
+		 * inheriting transformation.
+		 * If enabled = 0, you can use x, y, width, height instead.
 		 */
 		int enabled;
 		struct weston_matrix matrix;
-- 
1.7.8.6



More information about the wayland-devel mailing list