[PATCH weston 4/8] pixman-renderer: add view_transformation_is_translation()

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 6 03:03:59 PST 2015


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

A simple refactoring just to help readability.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/pixman-renderer.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 459b20a..ecb4109 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -298,6 +298,18 @@ pixman_renderer_compute_transform(pixman_transform_t *transform_out,
 	*transform_out = transform;
 }
 
+static bool
+view_transformation_is_translation(struct weston_view *view)
+{
+	if (!view->transform.enabled)
+		return true;
+
+	if (view->transform.matrix.type <= WESTON_MATRIX_TRANSFORM_TRANSLATE)
+		return true;
+
+	return false;
+}
+
 static void
 region_intersect_only_translation(pixman_region32_t *result_global,
 				  pixman_region32_t *global,
@@ -428,9 +440,7 @@ draw_view(struct weston_view *ev, struct weston_output *output,
 	}
 
 	/* TODO: Implement repaint_region_complex() using pixman_composite_trapezoids() */
-	if (ev->alpha != 1.0 ||
-	    (ev->transform.enabled &&
-	     ev->transform.matrix.type != WESTON_MATRIX_TRANSFORM_TRANSLATE)) {
+	if (ev->alpha != 1.0 || !view_transformation_is_translation(ev)) {
 		repaint_region(ev, output, &repaint, NULL, PIXMAN_OP_OVER);
 	} else {
 		/* blended region is whole surface minus opaque region: */
-- 
2.0.5



More information about the wayland-devel mailing list