diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-09-05 23:57:09 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-09-05 23:57:09 +0000 |
commit | c17037a80266e9e97643e8c34459f3ac81510be0 (patch) | |
tree | a28fa4f0bb9339cdd6d900276e4694f8be5a02ee /apps/gui/viewport.c | |
parent | a17d06ccc3b589cfc5eb92edbea3c09494b1ed48 (diff) | |
download | rockbox-c17037a80266e9e97643e8c34459f3ac81510be0.tar.gz rockbox-c17037a80266e9e97643e8c34459f3ac81510be0.zip |
Factor out/generalise the function that checks whether a point is within a viewport to, and use it in the wps' touchregion code. This corrects the check that was done there.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r-- | apps/gui/viewport.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index e05cd78970..63f0b8fc20 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -401,4 +401,13 @@ static unsigned viewport_init_ui_vp(void) | |||
401 | return ret; | 401 | return ret; |
402 | } | 402 | } |
403 | 403 | ||
404 | #ifdef HAVE_TOUCHSCREEN | ||
405 | /* check if a point (x and y coordinates) are within a viewport */ | ||
406 | bool viewport_point_within_vp(const struct viewport *vp, int x, int y) | ||
407 | { | ||
408 | bool is_x = (x >= vp->x && x < (vp->x + vp->width)); | ||
409 | bool is_y = (y >= vp->y && y < (vp->y + vp->height)); | ||
410 | return (is_x && is_y); | ||
411 | } | ||
412 | #endif /* HAVE_TOUCHSCREEN */ | ||
404 | #endif /* HAVE_LCD_BITMAP */ | 413 | #endif /* HAVE_LCD_BITMAP */ |