[PATCH v5 xserver 5/7] xf86Cursor: Fix xf86_crtc_rotate_coord_back using width/height wrongly

Hans de Goede hdegoede at redhat.com
Tue Sep 6 11:31:15 UTC 2016


xf86_crtc_rotate_coord_back should be the exact inverse operation of
xf86_crtc_rotate_coord, but when calculating x / y for 90 / 270 degrees
rotation it was using height to calculate x / width to calculate y,
instead of the otherway around.

This was likely not noticed before since xf86_crtc_rotate_coord_back
until now was only used with cursor_info->MaxWidth and
cursor_info->MaxHeight, which are usally the same.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hw/xfree86/modes/xf86Cursors.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 1a8e9d5..bf98d7e 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -117,7 +117,7 @@ xf86_crtc_rotate_coord_back(Rotation rotation,
     case RR_Rotate_90:
         t = x_dst;
         x_dst = y_dst;
-        y_dst = width - t - 1;
+        y_dst = height - t - 1;
         break;
     case RR_Rotate_180:
         x_dst = width - x_dst - 1;
@@ -125,7 +125,7 @@ xf86_crtc_rotate_coord_back(Rotation rotation,
         break;
     case RR_Rotate_270:
         t = x_dst;
-        x_dst = height - y_dst - 1;
+        x_dst = width - y_dst - 1;
         y_dst = t;
         break;
     }
-- 
2.9.3



More information about the xorg-devel mailing list