mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
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.
This commit is contained in:
parent
c5376c2d2c
commit
f22a5d1704
@ -91,32 +91,32 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
|
||||
dest->y = src.y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
dest->x = src.y;
|
||||
dest->y = width - src.x - src.width;
|
||||
dest->x = height - src.y - src.height;
|
||||
dest->y = src.x;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
dest->x = width - src.x - src.width;
|
||||
dest->y = height - src.y - src.height;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
dest->x = height - src.y - src.height;
|
||||
dest->y = src.x;
|
||||
dest->x = src.y;
|
||||
dest->y = width - src.x - src.width;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
dest->x = width - src.x - src.width;
|
||||
dest->y = src.y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
dest->x = height - src.y - src.height;
|
||||
dest->y = width - src.x - src.width;
|
||||
dest->x = src.y;
|
||||
dest->y = src.x;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
dest->x = src.x;
|
||||
dest->y = height - src.y - src.height;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
dest->x = src.y;
|
||||
dest->y = src.x;
|
||||
dest->x = height - src.y - src.height;
|
||||
dest->y = width - src.x - src.width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -366,32 +366,32 @@ static void apply_output_transform(double *x, double *y,
|
||||
dy = *y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
dx = *y;
|
||||
dy = width - *x;
|
||||
dx = height - *y;
|
||||
dy = *x;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
dx = width - *x;
|
||||
dy = height - *y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
dx = height - *y;
|
||||
dy = *x;
|
||||
dx = *y;
|
||||
dy = width - *x;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
dx = width - *x;
|
||||
dy = *y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
dx = height - *y;
|
||||
dy = width - *x;
|
||||
dx = *y;
|
||||
dy = *x;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
dx = *x;
|
||||
dy = height - *y;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
dx = *y;
|
||||
dy = *x;
|
||||
dx = height - *y;
|
||||
dy = width - *x;
|
||||
break;
|
||||
}
|
||||
*x = dx;
|
||||
|
@ -76,8 +76,8 @@ static const float transforms[][9] = {
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_90] = {
|
||||
0.0f, -1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_180] = {
|
||||
@ -86,8 +86,8 @@ static const float transforms[][9] = {
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_270] = {
|
||||
0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_FLIPPED] = {
|
||||
@ -96,8 +96,8 @@ static const float transforms[][9] = {
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_FLIPPED_90] = {
|
||||
0.0f, -1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_FLIPPED_180] = {
|
||||
@ -106,8 +106,8 @@ static const float transforms[][9] = {
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
[WL_OUTPUT_TRANSFORM_FLIPPED_270] = {
|
||||
0.0f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, -1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f,
|
||||
},
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user