[PATCH xserver resent] xf86ScaleAxis: support for high resolution devices

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 15 15:23:44 PDT 2010


On Wed, Apr 14, 2010 at 05:27:51PM +0200, Benjamin Tissoires wrote:
> High resolution devices was generating integer overflow.
> For instance the wacom Cintiq 21UX has an axis value up to
> 87000. Thus the term (dSx * (Cx - Rxlow)) is greater than
> MAX_INT32.
> 
> Using 64bits integer avoids such problem.
> 
> Signed-off-by: Philippe Ribet <ribet at cena.fr>
> Signed-off-by: Benjamin Tissoires <tissoire at cena.fr>
> ---
>  hw/xfree86/common/xf86Xinput.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index 7723ba6..dba3370 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -86,6 +86,7 @@
>  #include "windowstr.h"	/* screenIsSaved */
>  
>  #include <stdarg.h>
> +#include <stdint.h>          /* for int64_t */
>  
>  #include <X11/Xpoll.h>
>  
> @@ -1177,12 +1178,11 @@ xf86ScaleAxis(int	Cx,
>                int	Rxlow )
>  {
>      int X;
> -    int dSx = Sxhigh - Sxlow;
> -    int dRx = Rxhigh - Rxlow;
> +    int64_t dSx = Sxhigh - Sxlow;
> +    int64_t dRx = Rxhigh - Rxlow;
>  
> -    dSx = Sxhigh - Sxlow;
>      if (dRx) {
> -	X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
> +	X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);
>      }
>      else {
>  	X = 0;
> -- 
> 1.6.6.1

merged into my tree, thank you.

Cheers,
  Peter


More information about the xorg-devel mailing list