aboutsummaryrefslogtreecommitdiff
path: root/util/region.c
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2020-02-09 09:57:40 -0500
committerDrew DeVault <sir@cmpwn.com>2020-02-17 21:43:05 +0100
commitf22a5d17041e339b3ee7ab7975d40b353ab745c3 (patch)
tree06f515fa5e6b2263d202c43acc6a86aa1c21ed93 /util/region.c
parentc5376c2d2c7bd4615a6b8dd9ee04f92249080f46 (diff)
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.
Diffstat (limited to 'util/region.c')
-rw-r--r--util/region.c32
1 files changed, 16 insertions, 16 deletions
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;
}
}