dix: split softening and constant deceleration into two functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
This commit is contained in:
Peter Hutterer 2011-04-20 15:32:33 +10:00
parent 8ae90552f9
commit 5870d507ce

View File

@ -709,7 +709,7 @@ ApplySimpleSoftening(int prev_delta, int delta)
static void static void
ApplySofteningAndConstantDeceleration( ApplySoftening(
DeviceVelocityPtr vel, DeviceVelocityPtr vel,
int dx, int dx,
int dy, int dy,
@ -724,7 +724,11 @@ ApplySofteningAndConstantDeceleration(
*fdx = dx; *fdx = dx;
*fdy = dy; *fdy = dy;
} }
}
static void
ApplyConstantDeceleration(DeviceVelocityPtr vel, float *fdx, float *fdy)
{
*fdx *= vel->const_acceleration; *fdx *= vel->const_acceleration;
*fdy *= vel->const_acceleration; *fdy *= vel->const_acceleration;
} }
@ -1149,10 +1153,11 @@ acceleratePointerPredictable(
(float)dev->ptrfeed->ctrl.den); (float)dev->ptrfeed->ctrl.den);
if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) { if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
ApplySofteningAndConstantDeceleration(velocitydata, ApplySoftening(velocitydata,
dx, dy, dx, dy,
&fdx, &fdy, &fdx, &fdy,
(mult > 1.0f) && soften); (mult > 1.0f) && soften);
ApplyConstantDeceleration(velocitydata, &fdx, &fdy);
/* Calculate the new delta (with accel) and drop it back /* Calculate the new delta (with accel) and drop it back
* into the valuator masks */ * into the valuator masks */