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

Keith Packard keithp at keithp.com
Thu Apr 15 11:06:14 PDT 2010


On Wed, 14 Apr 2010 17:27:51 +0200, Benjamin Tissoires <tissoire at cena.fr> 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>

Reviewed-by: Keith Packard <keithp at keithp.com>

>      int X;
> -    int dSx = Sxhigh - Sxlow;
> -    int dRx = Rxhigh - Rxlow;
> +    int64_t dSx = Sxhigh - Sxlow;
> +    int64_t dRx = Rxhigh - Rxlow;
>  
> -    dSx = Sxhigh - Sxlow;

Was this value really computed twice before? Sigh.

>      if (dRx) {
> -	X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
> +	X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100415/5309da56/attachment.pgp>


More information about the xorg-devel mailing list