On Wed, Aug 05, 2015 at 04:32:39PM +1000, Peter Hutterer wrote:
> No functional changes.
> 
> Signed-off-by: Peter Hutterer <[email protected]>

Reviewed-by: Jonas Ådahl <[email protected]>

> ---
>  src/filter.c | 35 +++++++++++++++++++++++++----------
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/src/filter.c b/src/filter.c
> index 828d6b6..68f1786 100644
> --- a/src/filter.c
> +++ b/src/filter.c
> @@ -266,6 +266,27 @@ calculate_acceleration(struct pointer_accelerator *accel,
>       return factor; /* unitless factor */
>  }
>  
> +static inline double
> +calculate_acceleration_factor(struct pointer_accelerator *accel,
> +                           const struct normalized_coords *unaccelerated,
> +                           void *data,
> +                           uint64_t time)
> +{
> +     double velocity; /* units/us */
> +     double accel_factor;
> +
> +     feed_trackers(accel, unaccelerated, time);
> +     velocity = calculate_velocity(accel, time);
> +     accel_factor = calculate_acceleration(accel,
> +                                           data,
> +                                           velocity,
> +                                           accel->last_velocity,
> +                                           time);
> +     accel->last_velocity = velocity;
> +
> +     return accel_factor;
> +}
> +
>  static struct normalized_coords
>  accelerator_filter(struct motion_filter *filter,
>                  const struct normalized_coords *unaccelerated,
> @@ -273,7 +294,6 @@ accelerator_filter(struct motion_filter *filter,
>  {
>       struct pointer_accelerator *accel =
>               (struct pointer_accelerator *) filter;
> -     double velocity; /* units/us */
>       double accel_value; /* unitless factor */
>       struct normalized_coords accelerated;
>       struct normalized_coords unnormalized;
> @@ -285,19 +305,14 @@ accelerator_filter(struct motion_filter *filter,
>       unnormalized.x = unaccelerated->x * dpi_factor;
>       unnormalized.y = unaccelerated->y * dpi_factor;
>  
> -     feed_trackers(accel, &unnormalized, time);
> -     velocity = calculate_velocity(accel, time);
> -     accel_value = calculate_acceleration(accel,
> -                                          data,
> -                                          velocity,
> -                                          accel->last_velocity,
> -                                          time);
> +     accel_value = calculate_acceleration_factor(accel,
> +                                                 &unnormalized,
> +                                                 data,
> +                                                 time);
>  
>       accelerated.x = accel_value * unnormalized.x;
>       accelerated.y = accel_value * unnormalized.y;
>  
> -     accel->last_velocity = velocity;
> -
>       return accelerated;
>  }
>  
> -- 
> 2.4.3
> 
> _______________________________________________
> wayland-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to