summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-07 20:55:22 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-07 21:11:26 -0700
commitbd315a4804cf60123c7016ece084f2593df5101f (patch)
tree757f8b8d6c8d112669fd8af18f8330a51db1a2bf /profile.c
parent77b2df664d803371160089720e9be37adbbb076c (diff)
downloadsubsurface-bd315a4804cf60123c7016ece084f2593df5101f.tar.gz
Show the shallow points of the dive too
.. unless they are so shallow that they are basically at the surface. These show up automatically in out min/max logic, so just go ahead and show them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/profile.c b/profile.c
index 9b91ca7b1..16522db99 100644
--- a/profile.c
+++ b/profile.c
@@ -63,7 +63,7 @@ typedef struct {
enum {MIDDLE,TOP,BOTTOM} valign;
} text_render_options_t;
-static void plot_text(struct graphics_context *gc, text_render_options_t *tro,
+static void plot_text(struct graphics_context *gc, const text_render_options_t *tro,
double x, double y, const char *fmt, ...)
{
cairo_t *cr = gc->cr;
@@ -113,9 +113,8 @@ static void plot_text(struct graphics_context *gc, text_render_options_t *tro,
cairo_show_text(cr, buffer);
}
-static void render_depth_sample(struct graphics_context *gc, struct sample *sample)
+static void render_depth_sample(struct graphics_context *gc, struct sample *sample, const text_render_options_t *tro)
{
- text_render_options_t tro = {14, 1.0, 0.2, 0.2, CENTER, TOP};
int sec = sample->time.seconds;
depth_t depth = sample->depth;
const char *fmt;
@@ -131,7 +130,7 @@ static void render_depth_sample(struct graphics_context *gc, struct sample *samp
fmt = "%.0f";
break;
}
- plot_text(gc, &tro, sec, depth.mm, fmt, d);
+ plot_text(gc, tro, sec, depth.mm, fmt, d);
}
/*
@@ -183,16 +182,22 @@ static struct sample *next_minmax(struct sample *sample, struct sample *end, int
static void plot_text_samples(struct graphics_context *gc, struct sample *a, struct sample *b)
{
+ static const text_render_options_t deep = {14, 1.0, 0.2, 0.2, CENTER, TOP};
+ static const text_render_options_t shallow = {14, 1.0, 0.2, 0.2, CENTER, BOTTOM};
+
for (;;) {
if (b <= a)
break;
a = next_minmax(a, b, 1);
if (!a)
break;
- render_depth_sample(gc, a);
+ render_depth_sample(gc, a, &deep);
a = next_minmax(a, b, 0);
if (!a)
break;
+ if (a->depth.mm < 2500)
+ continue;
+ render_depth_sample(gc, a, &shallow);
}
}