X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ffilter.c;h=5b0b87744666f648f04f6fcfc9c7e1a564f898b2;hb=468e6288082ee61ac6a4663726a2728e413804e1;hp=7db78bae2cc249d3ef174751e9772b1fddc69dae;hpb=066092a04fd2a9419c392575cd1675d91c550d8c;p=platform%2Fupstream%2Flibinput.git diff --git a/src/filter.c b/src/filter.c index 7db78ba..5b0b877 100644 --- a/src/filter.c +++ b/src/filter.c @@ -51,8 +51,7 @@ filter_destroy(struct motion_filter *filter) * Default parameters for pointer acceleration profiles. */ -#define DEFAULT_CONSTANT_ACCELERATION 10.0 /* unitless factor */ -#define DEFAULT_THRESHOLD 4.0 /* in units/ms */ +#define DEFAULT_THRESHOLD 0.4 /* in units/ms */ #define DEFAULT_ACCELERATION 2.0 /* unitless factor */ /* @@ -335,13 +334,13 @@ pointer_accel_profile_smooth_simple(struct motion_filter *filter, double threshold = DEFAULT_THRESHOLD; /* units/ms */ double accel = DEFAULT_ACCELERATION; /* unitless factor */ double smooth_accel_coefficient; /* unitless factor */ + double factor; /* unitless factor */ - if (threshold < 1.0) - threshold = 1.0; + if (threshold < 0.1) + threshold = 0.1; if (accel < 1.0) accel = 1.0; - velocity *= DEFAULT_CONSTANT_ACCELERATION; if (velocity < (threshold / 2.0)) return calc_penumbral_gradient(0.5 + velocity / threshold) * 2.0 - 1.0; @@ -349,12 +348,12 @@ pointer_accel_profile_smooth_simple(struct motion_filter *filter, if (velocity <= threshold) return 1.0; - velocity /= threshold; - if (velocity >= accel) + factor = velocity/threshold; + if (factor >= accel) return accel; - /* Velocity is between 1.0 and accel, scale this to 0.0 - 1.0 */ - velocity = (velocity - 1.0) / (accel - 1.0); - smooth_accel_coefficient = calc_penumbral_gradient(velocity); + /* factor is between 1.0 and accel, scale this to 0.0 - 1.0 */ + factor = (factor - 1.0) / (accel - 1.0); + smooth_accel_coefficient = calc_penumbral_gradient(factor); return 1.0 + (smooth_accel_coefficient * (accel - 1.0)); }