mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-06 16:40:12 +01:00
dix: fix warning in pointer acceleration
newer gcc's warn against how this cast is done (though it eludes me why), and lrintf() is also faster especially on insane processors like the P4 (http://www.mega-nerd.com/FPcast). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d220d6907d
commit
ee30e1b102
1 changed files with 8 additions and 2 deletions
|
|
@ -988,14 +988,20 @@ acceleratePointerPredictable(
|
|||
|
||||
if (dx) {
|
||||
tmp = mult * fdx + pDev->last.remainder[0];
|
||||
*px = (int)roundf(tmp);
|
||||
/* Since it may not be apparent: lrintf() does not offer
|
||||
* strong statements about rounding; however because we
|
||||
* process each axis conditionally, there's no danger
|
||||
* of a toggling remainder. Its lack of guarantees hopefully
|
||||
* makes it faster on the average target. */
|
||||
*px = lrintf(tmp);
|
||||
pDev->last.remainder[0] = tmp - (float)*px;
|
||||
}
|
||||
if (dy) {
|
||||
tmp = mult * fdy + pDev->last.remainder[1];
|
||||
*py = (int)roundf(tmp);
|
||||
*py = lrintf(tmp);
|
||||
pDev->last.remainder[1] = tmp - (float)*py;
|
||||
}
|
||||
DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n", *px, *py, pDev->last.remainder[0], pDev->last.remainder[1], fdx, fdy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue