[PATCH 09/20] dix: CalcTracker only uses the tracker, thus only pass the tracker.

Simon Thum simon.thum at gmx.de
Wed Apr 20 14:36:32 PDT 2011


On 04/20/2011 08:28 AM, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  dix/ptrveloc.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
> index 12c4067..be5f626 100644
> --- a/dix/ptrveloc.c
> +++ b/dix/ptrveloc.c
> @@ -572,11 +572,9 @@ FeedTrackers(DeviceVelocityPtr vel, int dx, int dy, int cur_t)
>   * This assumes linear motion.
>   */
>  static float
> -CalcTracker(DeviceVelocityPtr vel, int offset, int cur_t){
> -    int index = TRACKER_INDEX(vel, offset);
> -    float dist = sqrt(  vel->tracker[index].dx * vel->tracker[index].dx
> -                      + vel->tracker[index].dy * vel->tracker[index].dy);
> -    int dtime = cur_t - vel->tracker[index].time;
> +CalcTracker(const MotionTracker *tracker, int cur_t){
> +    float dist = sqrt(tracker->dx * tracker->dx + tracker->dy * tracker->dy);
> +    int dtime = cur_t - tracker->time;
>      if(dtime > 0)
>  	return dist / dtime;
>      else
> @@ -621,7 +619,7 @@ QueryTrackers(DeviceVelocityPtr vel, int cur_t){
>  	    break;
>  	}
>  
> -	tmp = CalcTracker(vel, offset, cur_t) * vfac;
> +	tmp = CalcTracker(&vel->tracker[n], cur_t) * vfac;
>  
>  	if ((iveloc == 0 || offset <= vel->initial_range) && tmp != 0) {
>  	    /* set initial velocity and result */
Much better.

Reviewed-by: Simon Thum <simon.thum at gmx.de>

Cheers,

Simon



More information about the xorg-devel mailing list