size_t count = tablet_history_size(tablet);
struct tablet_axes smooth = { 0 };
+ if (count <= 0)
+ return;
+
for (i = 0; i < count; i++) {
const struct tablet_axes *a = tablet_history_get(tablet, i);
smooth.tilt.y += a->tilt.y;
}
- axes->point.x = smooth.point.x/count;
- axes->point.y = smooth.point.y/count;
+ axes->point.x = smooth.point.x/(double)count;
+ axes->point.y = smooth.point.y/(double)count;
- axes->tilt.x = smooth.tilt.x/count;
- axes->tilt.y = smooth.tilt.y/count;
+ axes->tilt.x = smooth.tilt.x/(double)count;
+ axes->tilt.y = smooth.tilt.y/(double)count;
}
static bool