summaryrefslogtreecommitdiffstats
path: root/apps/gui/viewport.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-11-04 21:08:21 +0000
committerThomas Martitz <kugel@rockbox.org>2009-11-04 21:08:21 +0000
commite9c900d09de17eb4367a607b723b77e7228d3cee (patch)
treeb1f2d4a99b035e3b09e77da97b66d7211afdd8f4 /apps/gui/viewport.c
parentea6178065c6df158db18793c72669393a37198e2 (diff)
downloadrockbox-e9c900d09de17eb4367a607b723b77e7228d3cee.tar.gz
rockbox-e9c900d09de17eb4367a607b723b77e7228d3cee.zip
Fix a possiblity where viewport_set_default left the viewport unchanged. Improve comments a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23521 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r--apps/gui/viewport.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 061a11895a..b40f244ab2 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -379,22 +379,25 @@ void viewport_set_defaults(struct viewport *vp,
if (sbs_area && user_setting)
{
struct viewport *a = sbs_area, *b = user_setting;
- /* make sure they do actually overlap,
- * if they dont its user error, so use the full display
- * and live with redraw problems */
+ /* if ui vp and info vp overlap, intersect */
if (a->x < b->x + b->width &&
a->x + a->width > b->x &&
a->y < b->y + b->height &&
a->y + a->height > b->y)
- {
+ { /* interesect so that the ui viewport is cropped so that it
+ * is completely within the info vp */
vp->x = MAX(a->x, b->x);
vp->y = MAX(a->y, b->y);
vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x;
vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y;
+ return;
}
+ /* else take info vp below */
}
- /* only one so use it */
- else if (sbs_area)
+ /* if only one is active use it
+ * or if the above check for overlapping failed, use info vp then, because
+ * that doesn't give redraw problems */
+ if (sbs_area)
*vp = *sbs_area;
else if (user_setting)
*vp = *user_setting;