diff options
author | Daniel Stone <daniel@fooishbar.org> | 2011-03-02 14:50:29 +0000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-10 11:28:23 +1000 |
commit | 66e953d8638dd6240af9b3e7360e1bdd24b80228 (patch) | |
tree | 4ad5fe296095e55b89f4381b2bf6eaaf2dc08a73 | |
parent | 9963e29da564006591ea1db3c936839c0d05a32d (diff) |
Input: Convert transformAbsolute to work on doubles
Change transformAbsolute to use doubles internally.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit cdf202250ef616f3b261db70da30e421ea59a630)
-rw-r--r-- | dix/getevents.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index c3981d533..845050f56 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1074,32 +1074,37 @@ FreeEventList(EventListPtr list, int num_events) * back into x/y. */ static void -transform(struct pixman_f_transform *m, int *x, int *y) +transform(struct pixman_f_transform *m, double *x, double *y) { struct pixman_f_vector p = {.v = {*x, *y, 1}}; pixman_f_transform_point(m, &p); - *x = lround(p.v[0]); - *y = lround(p.v[1]); + *x = p.v[0]; + *y = p.v[1]; } static void transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask) { - int x, y, ox, oy; + double x, y, ox, oy; - ox = x = valuator_mask_isset(mask, 0) ? valuator_mask_get(mask, 0) : - dev->last.valuators[0]; - oy = y = valuator_mask_isset(mask, 1) ? valuator_mask_get(mask, 1) : - dev->last.valuators[1]; + if (valuator_mask_isset(mask, 0)) + ox = x = valuator_mask_get_double(mask, 0); + else + ox = x = dev->last.valuators[0] + dev->last.remainder[0]; + + if (valuator_mask_isset(mask, 1)) + oy = y = valuator_mask_get_double(mask, 1); + else + oy = y = dev->last.valuators[1] + dev->last.remainder[1]; transform(&dev->transform, &x, &y); if (valuator_mask_isset(mask, 0) || ox != x) - valuator_mask_set(mask, 0, x); + valuator_mask_set_double(mask, 0, x); if (valuator_mask_isset(mask, 1) || oy != y) - valuator_mask_set(mask, 1, y); + valuator_mask_set_double(mask, 1, y); } /** |