summaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/frame.c b/src/frame.c
index 9c4be97..e722adf 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -205,6 +205,25 @@ int utouch_frame_set_current_slot(utouch_frame_handle fh, int slot)
205 return 0; 205 return 0;
206} 206}
207 207
208static void transform_slot(struct utouch_contact *slot,
209 const struct utouch_surface *s)
210{
211 float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);
212 float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);
213 /* assume clipped view for asymmetrical scaling */
214 float f = MAX(fx, fy);
215
216 slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;
217 slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;
218 slot->touch_major *= f;
219 slot->touch_minor *= f;
220 slot->width_major *= f;
221 slot->width_minor *= f;
222 slot->orientation *= M_PI_2 / s->max_orient;
223 slot->pressure *= s->mapped_max_pressure / s->max_pressure;
224 slot->distance *= f;
225}
226
208static void copy_contact(utouch_frame_handle fh, 227static void copy_contact(utouch_frame_handle fh,
209 struct utouch_contact *a, 228 struct utouch_contact *a,
210 const struct utouch_contact *b) 229 const struct utouch_contact *b)
@@ -225,6 +244,8 @@ static void copy_contact(utouch_frame_handle fh,
225 a->orientation = b->orientation; 244 a->orientation = b->orientation;
226 a->pressure = b->pressure; 245 a->pressure = b->pressure;
227 a->distance = b->distance; 246 a->distance = b->distance;
247
248 transform_slot(a, s);
228} 249}
229 250
230static int detect_addrem(const struct utouch_contact *a, 251static int detect_addrem(const struct utouch_contact *a,