summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-31 14:35:31 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-08-31 14:35:31 -0700
commitee56021dfbc3bcc12f5917cdf481cc96c51a2b89 (patch)
treeb5cecc31b8d19fb290099a6b6d5fe4ad1661ae8f /profile.c
parent059f047788a9549e448f6e9f108a9f55b81ee64c (diff)
downloadsubsurface-ee56021dfbc3bcc12f5917cdf481cc96c51a2b89.tar.gz
dive profile plot: use saner minimum limits
The time minimum was in seconds, not minutes, and we really do want to show at least to 90ft to make shallow dives look shallow rather than scaled to some full depth. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index b67557088..f898be745 100644
--- a/profile.c
+++ b/profile.c
@@ -8,16 +8,21 @@
int selected_dive = 0;
#define ROUND_UP(x,y) ((((x)+(y)-1)/(y))*(y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
+/*
+ * When showing dive profiles, we scale things to the
+ * current dive. However, we don't scale past less than
+ * 30 minutes or 90 ft, just so that small dives show
+ * up as such.
+ */
static int round_seconds_up(int seconds)
{
- return MAX(30, ROUND_UP(seconds, 60*10));
+ return MAX(30*60, ROUND_UP(seconds, 60*10));
}
static int round_feet_up(int feet)
{
- return MAX(45, ROUND_UP(feet+5, 15));
+ return MAX(90, ROUND_UP(feet+5, 15));
}
/* Scale to 0,0 -> maxx,maxy */