diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-05-14 01:10:17 +0200 |
---|---|---|
committer | Henrik Rydberg <rydberg@euromail.se> | 2010-05-14 01:41:39 +0200 |
commit | 2b271ed5348daec2bcf90b83da47781e2d8b964c (patch) | |
tree | 1828f251cf4b7d4f6a66a6af67c2681998f2483e /src/hwstate.c | |
parent | f02210172efc6bfc05c4598c14e1268d2828097e (diff) | |
download | xorg-input-kobomultitouch-2b271ed5348daec2bcf90b83da47781e2d8b964c.tar.gz xorg-input-kobomultitouch-2b271ed5348daec2bcf90b83da47781e2d8b964c.tar.bz2 xorg-input-kobomultitouch-2b271ed5348daec2bcf90b83da47781e2d8b964c.zip |
janitor: Move min/max and dist functions up to common.h
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/hwstate.c')
-rw-r--r-- | src/hwstate.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/hwstate.c b/src/hwstate.c index 07bab31..a68b81a 100644 --- a/src/hwstate.c +++ b/src/hwstate.c @@ -25,27 +25,11 @@ #define NOTOUCH(hw, c) ((hw)->touch_major == 0 && (c)->has_touch_major) -const int XMAX = 32767; - void init_hwstate(struct HWState *s) { memset(s, 0, sizeof(struct HWState)); } -static inline int clamp15(int x) -{ - return x < -XMAX ? -XMAX : x > XMAX ? XMAX : x; -} - -/* abslute scale is assumed to fit in 15 bits */ -inline int dist2(const struct FingerData *a, const struct FingerData *b) -{ - int dx = clamp15(a->position_x - b->position_x); - int dy = clamp15(a->position_y - b->position_y); - - return dx * dx + dy * dy; -} - /* Dmitry Torokhov's code from kernel/driver/input/input.c */ static int defuzz(int value, int old_val, int fuzz) { @@ -104,7 +88,7 @@ void modify_hwstate(struct HWState *s, sid[j] = 0; row = A + hw->nfinger * j; for (i = 0; i < hw->nfinger; i++) - row[i] = dist2(&hw->finger[i], &s->finger[j].hw); + row[i] = finger_dist2(&hw->finger[i], &s->finger[j].hw); } match_fingers(hw2s, A, hw->nfinger, s->nfinger); |