summaryrefslogtreecommitdiff
path: root/src/grail-gestures.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-08-11 17:30:43 +0100
committerHenrik Rydberg <rydberg@euromail.se>2010-08-11 17:59:29 +0100
commit9b020a9c6ff875c5f6511b50480f07beabb9a694 (patch)
treec36896613eb0161805e72c8c3f909415f5271858 /src/grail-gestures.c
parent6f3c666291dfd1442146883eeaee02570351604d (diff)
split out bounding box computation
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/grail-gestures.c')
-rw-r--r--src/grail-gestures.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/grail-gestures.c b/src/grail-gestures.c
index f1e2093..33d848c 100644
--- a/src/grail-gestures.c
+++ b/src/grail-gestures.c
@@ -218,3 +218,27 @@ void gru_end(struct grail *ge, int gid, const struct move_model *m,
218 prop, nprop); 218 prop, nprop);
219} 219}
220 220
221void gru_compute_bbox(struct grail_coord *min, struct grail_coord *max,
222 const struct touch_frame *frame)
223{
224 float x, y;
225 int i;
226 if (frame->nactive < 1)
227 return;
228 x = frame->active[0]->prop[TP_POS_X];
229 y = frame->active[0]->prop[TP_POS_Y];
230 min->x = max->x = x;
231 min->y = max->y = y;
232 for (i = 1; i < frame->nactive; i++) {
233 x = frame->active[i]->prop[TP_POS_X];
234 y = frame->active[i]->prop[TP_POS_Y];
235 if (x < min->x)
236 min->x = x;
237 if (y < min->y)
238 min->y = y;
239 if (x > max->x)
240 max->x = x;
241 if (y > max->y)
242 max->y = y;
243 }
244}