diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-04 14:18:35 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-05 00:18:30 -0800 |
commit | 635f190302cc3b00fb4daedd4fced940fcee7349 (patch) | |
tree | 04a7c0b20232708534f3f1fe11bb1e22eb9c6063 /profile.c | |
parent | cca847791ab0138ecc3597193dd1eab133ed3ee9 (diff) | |
download | subsurface-635f190302cc3b00fb4daedd4fced940fcee7349.tar.gz |
Fix profile display for dives with no samples
For dives with no samples, we crate a fake dive computer with a set of
made-up samples and use those to display the profile.
However, the actual calculations to do the maximum duration and depth
etc were always done with the "real" dive information, which is empty.
As a result, the scale of the plot ended up being bogus, and part of
the dive would be missing.
Trivially fix by just passing the same dive computer information to
calculate_max_limits() that we use for everything else.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1474,9 +1474,8 @@ static int count_gas_change_events(struct divecomputer *dc) return count; } -static void calculate_max_limits(struct dive *dive, struct graphics_context *gc) +static void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc) { - struct divecomputer *dc; struct plot_info *pi; int maxdepth = 0; int maxtime = 0; @@ -1500,7 +1499,6 @@ static void calculate_max_limits(struct dive *dive, struct graphics_context *gc) } /* Then do all the samples from all the dive computers */ - dc = &dive->dc; do { int i = dc->samples; int lastdepth = 0; @@ -1908,7 +1906,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale) * Set up limits that are independent of * the dive computer */ - calculate_max_limits(dive, gc); + calculate_max_limits(dive, dc, gc); /* shift the drawing area so we have a nice margin around it */ cairo_translate(gc->cr, drawing_area->x, drawing_area->y); |