diff options
Diffstat (limited to 'src/grail-inserter.c')
| -rw-r--r-- | src/grail-inserter.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/grail-inserter.c b/src/grail-inserter.c index 36ab570..2e5e7af 100644 --- a/src/grail-inserter.c +++ b/src/grail-inserter.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
| 22 | 22 | ||
| 23 | #include "grail-inserter.h" | 23 | #include "grail-inserter.h" |
| 24 | #include "grail-impl.h" | ||
| 24 | #include <malloc.h> | 25 | #include <malloc.h> |
| 25 | #include <string.h> | 26 | #include <string.h> |
| 26 | #include <errno.h> | 27 | #include <errno.h> |
| @@ -373,15 +374,18 @@ void grail_set_bbox(struct grail *ge, | |||
| 373 | const struct grail_coord *tmin, | 374 | const struct grail_coord *tmin, |
| 374 | const struct grail_coord *tmax) | 375 | const struct grail_coord *tmax) |
| 375 | { | 376 | { |
| 377 | struct touch_caps *caps = &ge->impl->dev.caps; | ||
| 376 | struct gesture_inserter *gin = ge->gin; | 378 | struct gesture_inserter *gin = ge->gin; |
| 377 | struct grail_coord dmin, dmax; | 379 | double tx, ty, dx, dy, sx, sy; |
| 378 | double sx, sy; | 380 | tx = tmax->x - tmin->x; |
| 379 | grail_get_units(ge, &dmin, &dmax); | 381 | ty = tmax->y - tmin->y; |
| 380 | sx = (tmax->x - tmin->x) / (dmax.x - dmin.x); | 382 | dx = caps->max_x - caps->min_x; |
| 381 | sy = (tmax->y - tmin->y) / (dmax.y - dmin.y); | 383 | dy = caps->max_y - caps->min_y; |
| 384 | sx = tx / dx; | ||
| 385 | sy = ty / dy; | ||
| 382 | gin->scale_x = sx; | 386 | gin->scale_x = sx; |
| 383 | gin->scale_y = sy; | 387 | gin->scale_y = sy; |
| 384 | gin->scale_r = sqrt((sx * sx + sy * sy) / 2); | 388 | gin->scale_r = sqrt((tx * tx + ty * ty) / (dx * dx + dy * dy)); |
| 385 | gin->trans_x = tmin->x - dmin.x * sx; | 389 | gin->trans_x = tmin->x - caps->min_x * sx; |
| 386 | gin->trans_y = tmin->y - dmin.y * sy; | 390 | gin->trans_y = tmin->y - caps->min_y * sy; |
| 387 | } | 391 | } |
