From f22a5d17041e339b3ee7ab7975d40b353ab745c3 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Sun, 9 Feb 2020 09:57:40 -0500 Subject: Fix output rotation direction The Wayland protocol specifies output transform rotations to be counterclockwise and applied to the surface. Previously, wlroots copied Weston and incorrectly made rotations act clockwise on surfaces. This commit fixes that. This change will break compositors which expect transform rotations to be clockwise, and the rare applications that make use of surface transforms. --- util/region.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'util/region.c') diff --git a/util/region.c b/util/region.c index a652dbf8..bfec4ed4 100644 --- a/util/region.c +++ b/util/region.c @@ -56,10 +56,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = src_rects[i].y2; break; case WL_OUTPUT_TRANSFORM_90: - dst_rects[i].x1 = src_rects[i].y1; - dst_rects[i].y1 = width - src_rects[i].x2; - dst_rects[i].x2 = src_rects[i].y2; - dst_rects[i].y2 = width - src_rects[i].x1; + dst_rects[i].x1 = height - src_rects[i].y2; + dst_rects[i].y1 = src_rects[i].x1; + dst_rects[i].x2 = height - src_rects[i].y1; + dst_rects[i].y2 = src_rects[i].x2; break; case WL_OUTPUT_TRANSFORM_180: dst_rects[i].x1 = width - src_rects[i].x2; @@ -68,10 +68,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = height - src_rects[i].y1; break; case WL_OUTPUT_TRANSFORM_270: - dst_rects[i].x1 = height - src_rects[i].y2; - dst_rects[i].y1 = src_rects[i].x1; - dst_rects[i].x2 = height - src_rects[i].y1; - dst_rects[i].y2 = src_rects[i].x2; + dst_rects[i].x1 = src_rects[i].y1; + dst_rects[i].y1 = width - src_rects[i].x2; + dst_rects[i].x2 = src_rects[i].y2; + dst_rects[i].y2 = width - src_rects[i].x1; break; case WL_OUTPUT_TRANSFORM_FLIPPED: dst_rects[i].x1 = width - src_rects[i].x2; @@ -80,10 +80,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = src_rects[i].y2; break; case WL_OUTPUT_TRANSFORM_FLIPPED_90: - dst_rects[i].x1 = height - src_rects[i].y2; - dst_rects[i].y1 = width - src_rects[i].x2; - dst_rects[i].x2 = height - src_rects[i].y1; - dst_rects[i].y2 = width - src_rects[i].x1; + dst_rects[i].x1 = src_rects[i].y1; + dst_rects[i].y1 = src_rects[i].x1; + dst_rects[i].x2 = src_rects[i].y2; + dst_rects[i].y2 = src_rects[i].x2; break; case WL_OUTPUT_TRANSFORM_FLIPPED_180: dst_rects[i].x1 = src_rects[i].x1; @@ -92,10 +92,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = height - src_rects[i].y1; break; case WL_OUTPUT_TRANSFORM_FLIPPED_270: - dst_rects[i].x1 = src_rects[i].y1; - dst_rects[i].y1 = src_rects[i].x1; - dst_rects[i].x2 = src_rects[i].y2; - dst_rects[i].y2 = src_rects[i].x2; + dst_rects[i].x1 = height - src_rects[i].y2; + dst_rects[i].y1 = width - src_rects[i].x2; + dst_rects[i].x2 = height - src_rects[i].y1; + dst_rects[i].y2 = width - src_rects[i].x1; break; } } -- cgit v1.2.3