evdev: Fix absolute coordinate transform formula

Since the device min/max x/y coordinates are inclusive, to get the
width/height one need to add one to (min x/y - max x/y).

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
Jonas Ådahl 2014-02-03 23:35:24 +01:00
parent bb52822ece
commit 512e964661

View file

@ -91,8 +91,8 @@ evdev_device_transform_x(struct evdev_device *device,
li_fixed_t x,
uint32_t width)
{
return (x - device->abs.min_x) * width /
(device->abs.max_x - device->abs.min_x);
return (x - li_fixed_from_int(device->abs.min_x)) * width /
(device->abs.max_x - device->abs.min_x + 1);
}
li_fixed_t
@ -100,8 +100,8 @@ evdev_device_transform_y(struct evdev_device *device,
li_fixed_t y,
uint32_t height)
{
return (y - device->abs.min_y) * height /
(device->abs.max_y - device->abs.min_y);
return (y - li_fixed_from_int(device->abs.min_y)) * height /
(device->abs.max_y - device->abs.min_y + 1);
}
static void