mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-10-30 07:30:46 +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;
|
dest->y = src.y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_90:
|
case WL_OUTPUT_TRANSFORM_90:
|
||||||
dest->x = src.y;
|
dest->x = height - src.y - src.height;
|
||||||
dest->y = width - src.x - src.width;
|
dest->y = src.x;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_180:
|
case WL_OUTPUT_TRANSFORM_180:
|
||||||
dest->x = width - src.x - src.width;
|
dest->x = width - src.x - src.width;
|
||||||
dest->y = height - src.y - src.height;
|
dest->y = height - src.y - src.height;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_270:
|
case WL_OUTPUT_TRANSFORM_270:
|
||||||
dest->x = height - src.y - src.height;
|
dest->x = src.y;
|
||||||
dest->y = src.x;
|
dest->y = width - src.x - src.width;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||||
dest->x = width - src.x - src.width;
|
dest->x = width - src.x - src.width;
|
||||||
dest->y = src.y;
|
dest->y = src.y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||||
dest->x = height - src.y - src.height;
|
dest->x = src.y;
|
||||||
dest->y = width - src.x - src.width;
|
dest->y = src.x;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||||
dest->x = src.x;
|
dest->x = src.x;
|
||||||
dest->y = height - src.y - src.height;
|
dest->y = height - src.y - src.height;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||||
dest->x = src.y;
|
dest->x = height - src.y - src.height;
|
||||||
dest->y = src.x;
|
dest->y = width - src.x - src.width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,32 +366,32 @@ static void apply_output_transform(double *x, double *y,
|
|||||||
dy = *y;
|
dy = *y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_90:
|
case WL_OUTPUT_TRANSFORM_90:
|
||||||
dx = *y;
|
dx = height - *y;
|
||||||
dy = width - *x;
|
dy = *x;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_180:
|
case WL_OUTPUT_TRANSFORM_180:
|
||||||
dx = width - *x;
|
dx = width - *x;
|
||||||
dy = height - *y;
|
dy = height - *y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_270:
|
case WL_OUTPUT_TRANSFORM_270:
|
||||||
dx = height - *y;
|
dx = *y;
|
||||||
dy = *x;
|
dy = width - *x;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||||
dx = width - *x;
|
dx = width - *x;
|
||||||
dy = *y;
|
dy = *y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||||
dx = height - *y;
|
dx = *y;
|
||||||
dy = width - *x;
|
dy = *x;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||||
dx = *x;
|
dx = *x;
|
||||||
dy = height - *y;
|
dy = height - *y;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||||
dx = *y;
|
dx = height - *y;
|
||||||
dy = *x;
|
dy = width - *x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*x = dx;
|
*x = dx;
|
||||||
|
@ -76,8 +76,8 @@ static const float transforms[][9] = {
|
|||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_90] = {
|
[WL_OUTPUT_TRANSFORM_90] = {
|
||||||
0.0f, -1.0f, 0.0f,
|
0.0f, 1.0f, 0.0f,
|
||||||
1.0f, 0.0f, 0.0f,
|
-1.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_180] = {
|
[WL_OUTPUT_TRANSFORM_180] = {
|
||||||
@ -86,8 +86,8 @@ static const float transforms[][9] = {
|
|||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_270] = {
|
[WL_OUTPUT_TRANSFORM_270] = {
|
||||||
0.0f, 1.0f, 0.0f,
|
0.0f, -1.0f, 0.0f,
|
||||||
-1.0f, 0.0f, 0.0f,
|
1.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_FLIPPED] = {
|
[WL_OUTPUT_TRANSFORM_FLIPPED] = {
|
||||||
@ -96,8 +96,8 @@ static const float transforms[][9] = {
|
|||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_FLIPPED_90] = {
|
[WL_OUTPUT_TRANSFORM_FLIPPED_90] = {
|
||||||
0.0f, -1.0f, 0.0f,
|
0.0f, 1.0f, 0.0f,
|
||||||
-1.0f, 0.0f, 0.0f,
|
1.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_FLIPPED_180] = {
|
[WL_OUTPUT_TRANSFORM_FLIPPED_180] = {
|
||||||
@ -106,8 +106,8 @@ static const float transforms[][9] = {
|
|||||||
0.0f, 0.0f, 1.0f,
|
0.0f, 0.0f, 1.0f,
|
||||||
},
|
},
|
||||||
[WL_OUTPUT_TRANSFORM_FLIPPED_270] = {
|
[WL_OUTPUT_TRANSFORM_FLIPPED_270] = {
|
||||||
0.0f, 1.0f, 0.0f,
|
0.0f, -1.0f, 0.0f,
|
||||||
1.0f, 0.0f, 0.0f,
|
-1.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.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;
|
dst_rects[i].y2 = src_rects[i].y2;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_90:
|
case WL_OUTPUT_TRANSFORM_90:
|
||||||
dst_rects[i].x1 = src_rects[i].y1;
|
dst_rects[i].x1 = height - src_rects[i].y2;
|
||||||
dst_rects[i].y1 = width - src_rects[i].x2;
|
dst_rects[i].y1 = src_rects[i].x1;
|
||||||
dst_rects[i].x2 = src_rects[i].y2;
|
dst_rects[i].x2 = height - src_rects[i].y1;
|
||||||
dst_rects[i].y2 = width - src_rects[i].x1;
|
dst_rects[i].y2 = src_rects[i].x2;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_180:
|
case WL_OUTPUT_TRANSFORM_180:
|
||||||
dst_rects[i].x1 = width - src_rects[i].x2;
|
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;
|
dst_rects[i].y2 = height - src_rects[i].y1;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_270:
|
case WL_OUTPUT_TRANSFORM_270:
|
||||||
dst_rects[i].x1 = height - src_rects[i].y2;
|
dst_rects[i].x1 = src_rects[i].y1;
|
||||||
dst_rects[i].y1 = src_rects[i].x1;
|
dst_rects[i].y1 = width - src_rects[i].x2;
|
||||||
dst_rects[i].x2 = height - src_rects[i].y1;
|
dst_rects[i].x2 = src_rects[i].y2;
|
||||||
dst_rects[i].y2 = src_rects[i].x2;
|
dst_rects[i].y2 = width - src_rects[i].x1;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||||
dst_rects[i].x1 = width - src_rects[i].x2;
|
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;
|
dst_rects[i].y2 = src_rects[i].y2;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||||
dst_rects[i].x1 = height - src_rects[i].y2;
|
dst_rects[i].x1 = src_rects[i].y1;
|
||||||
dst_rects[i].y1 = width - src_rects[i].x2;
|
dst_rects[i].y1 = src_rects[i].x1;
|
||||||
dst_rects[i].x2 = height - src_rects[i].y1;
|
dst_rects[i].x2 = src_rects[i].y2;
|
||||||
dst_rects[i].y2 = width - src_rects[i].x1;
|
dst_rects[i].y2 = src_rects[i].x2;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||||
dst_rects[i].x1 = src_rects[i].x1;
|
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;
|
dst_rects[i].y2 = height - src_rects[i].y1;
|
||||||
break;
|
break;
|
||||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||||
dst_rects[i].x1 = src_rects[i].y1;
|
dst_rects[i].x1 = height - src_rects[i].y2;
|
||||||
dst_rects[i].y1 = src_rects[i].x1;
|
dst_rects[i].y1 = width - src_rects[i].x2;
|
||||||
dst_rects[i].x2 = src_rects[i].y2;
|
dst_rects[i].x2 = height - src_rects[i].y1;
|
||||||
dst_rects[i].y2 = src_rects[i].x2;
|
dst_rects[i].y2 = width - src_rects[i].x1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user