From d4df421f8ba58533d46ceee7aeb4ee539377d76c Mon Sep 17 00:00:00 2001 From: hujianwei Date: Thu, 17 Nov 2022 02:11:15 +0000 Subject: [PATCH] Implement output transforms * output.c (ComputeTransform): Handle all combinations of rotation and X axis reflection. --- output.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/output.c b/output.c index 0e990fc..398fc12 100644 --- a/output.c +++ b/output.c @@ -375,8 +375,36 @@ ComputeSubpixel (XRROutputInfo *info) static uint32_t ComputeTransform (XRRCrtcInfo *info) { - /* TODO: support surface transforms. */ - return WL_OUTPUT_TRANSFORM_NORMAL; + switch (info->rotation) + { + case RR_Rotate_0: + return WL_OUTPUT_TRANSFORM_NORMAL; + + case RR_Rotate_90: + return WL_OUTPUT_TRANSFORM_90; + + case RR_Rotate_180: + return WL_OUTPUT_TRANSFORM_180; + + case RR_Rotate_270: + return WL_OUTPUT_TRANSFORM_270; + + case RR_Reflect_X | RR_Rotate_0: + return WL_OUTPUT_TRANSFORM_FLIPPED; + + case RR_Reflect_X | RR_Rotate_90: + return WL_OUTPUT_TRANSFORM_FLIPPED_90; + + case RR_Reflect_X | RR_Rotate_180: + return WL_OUTPUT_TRANSFORM_FLIPPED_180; + + case RR_Reflect_X | RR_Rotate_270: + return WL_OUTPUT_TRANSFORM_FLIPPED_270; + + /* How should Y axis reflection be handled here? */ + default: + return WL_OUTPUT_TRANSFORM_NORMAL; + } } static XLList *