[PATCH] DIX/ConfineTo: Improve algorithm to jump to the nearest point inside

Keith Packard keithp at keithp.com
Fri Feb 7 16:29:16 PST 2014


Egbert Eich <e4t at freenet.de> writes:

> Hi Keith,
>
> sorry for delaying this. I was occupied with other things and
> therefore wanted to wait for a bigger time window.

Thanks for your review in any case.

>> +static uint32_t
>> +ConfineToBox(int x, int y, BoxPtr box, int *px, int16_t *py)
>
>                                                     ^^^^^^
>    You probably want to use an int here or fix the other types
>    as well. As it is it will produce a big compiler warning.
>    I see your point here, you wanted to make sure that the 
>    distance ^ 2 still fits into an int. But this is already
>    done by clamping dx and dy to 32767.

Yes.

> You probably intended to do:
>
>        nbox = REGION_NUM_RECTS(shape);
>        for (i = 0; i < nbox; i++) {


And yes. Here's an updated version of the patch that also eliminates
three uninitialized variable warnings in the change:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Improved-ConfineToShape.patch
Type: text/x-diff
Size: 2657 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140207/c3cf9168/attachment.patch>
-------------- next part --------------

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


More information about the xorg-devel mailing list