diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2011-09-06 07:30:48 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-06 07:30:48 -0700 |
commit | d4db3e938b16c67d20a40833323f64ca5d0024f2 (patch) | |
tree | 11aa7afebd8935bf694f23ec11527b2d740307eb | |
parent | f7a36cfefd15a46494adfbf237f2db7f97d1fb1b (diff) | |
download | subsurface-d4db3e938b16c67d20a40833323f64ca5d0024f2.tar.gz |
Fix drawing artifact with UEMIS xml data
Only draw the pressure line to the final data point
(duration / end.mbar) if we haven't already drawn samples
past that point (as the UEMIS records pressure data for a
number of additional samples after the actual dive has ended)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[ Changed to use 'last actual drawn sample time that had pressure
data' instead of 'last sample time' - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | profile.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -127,7 +127,7 @@ static int get_cylinder_pressure_range(struct dive *dive, double *scalex, double static void plot_cylinder_pressure(struct dive *dive, cairo_t *cr, double topx, double topy, double maxx, double maxy) { - int i; + int i, sec = -1; double scalex, scaley; if (!get_cylinder_pressure_range(dive, &scalex, &scaley)) @@ -137,16 +137,21 @@ static void plot_cylinder_pressure(struct dive *dive, cairo_t *cr, cairo_move_to(cr, SCALE(0, dive->cylinder[0].start.mbar)); for (i = 1; i < dive->samples; i++) { - int sec, mbar; + int mbar; struct sample *sample = dive->sample + i; - sec = sample->time.seconds; mbar = sample->cylinderpressure.mbar; if (!mbar) continue; + sec = sample->time.seconds; cairo_line_to(cr, SCALE(sec, mbar)); } - cairo_line_to(cr, SCALE(dive->duration.seconds, dive->cylinder[0].end.mbar)); + /* + * We may have "surface time" events, in which case we don't go + * back to dive duration + */ + if (sec < dive->duration.seconds) + cairo_line_to(cr, SCALE(dive->duration.seconds, dive->cylinder[0].end.mbar)); cairo_stroke(cr); } |