From 77c7a64e8885696665556c9fbcb3cffb552e367a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 25 Feb 2009 10:12:23 -0800 Subject: [PATCH] RandR rotations and reflections offset by one pixel The matrix computation for rotation and reflection resulted in dropping a row or column of pixels as the offsets used in the matrix computations used width and height rather than width-1 and height-1. Signed-off-by: Keith Packard --- randr/rrtransform.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/randr/rrtransform.c b/randr/rrtransform.c index cc18a0662..e5e9438e5 100644 --- a/randr/rrtransform.c +++ b/randr/rrtransform.c @@ -185,21 +185,21 @@ RRTransformCompute (int x, break; case RR_Rotate_90: f_rot_cos = 0; f_rot_sin = 1; - f_rot_dx = height; f_rot_dy = 0; + f_rot_dx = height-1; f_rot_dy = 0; rot_cos = F ( 0); rot_sin = F ( 1); - rot_dx = F ( height); rot_dy = F (0); + rot_dx = F (height-1); rot_dy = F (0); break; case RR_Rotate_180: f_rot_cos = -1; f_rot_sin = 0; - f_rot_dx = width; f_rot_dy = height; + f_rot_dx = width - 1; f_rot_dy = height - 1; rot_cos = F (-1); rot_sin = F ( 0); - rot_dx = F (width); rot_dy = F ( height); + rot_dx = F (width-1); rot_dy = F ( height-1); break; case RR_Rotate_270: f_rot_cos = 0; f_rot_sin = -1; - f_rot_dx = 0; f_rot_dy = width; + f_rot_dx = 0; f_rot_dy = width-1; rot_cos = F ( 0); rot_sin = F (-1); - rot_dx = F ( 0); rot_dy = F ( width); + rot_dx = F ( 0); rot_dy = F ( width-1); break; } @@ -222,11 +222,11 @@ RRTransformCompute (int x, f_scale_x = -1; scale_x = F(-1); if (rotation & (RR_Rotate_0|RR_Rotate_180)) { - f_scale_dx = width; - scale_dx = F(width); + f_scale_dx = width-1; + scale_dx = F(width-1); } else { - f_scale_dx = height; - scale_dx = F(height); + f_scale_dx = height-1; + scale_dx = F(height-1); } } if (rotation & RR_Reflect_Y) @@ -234,11 +234,11 @@ RRTransformCompute (int x, f_scale_y = -1; scale_y = F(-1); if (rotation & (RR_Rotate_0|RR_Rotate_180)) { - f_scale_dy = height; - scale_dy = F(height); + f_scale_dy = height-1; + scale_dy = F(height-1); } else { - f_scale_dy = width; - scale_dy = F(width); + f_scale_dy = width-1; + scale_dy = F(width-1); } }