summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-07 18:57:04 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-07 18:57:04 -0700
commit77b2df664d803371160089720e9be37adbbb076c (patch)
treedeaa4af998ece05503656d76572fb61995bf0215 /profile.c
parent75f784267521e2a02c0c84ab4fe05c105dfc68f5 (diff)
downloadsubsurface-77b2df664d803371160089720e9be37adbbb076c.tar.gz
Move text rendering function upwards
No change in semantics, I'm just contemplating doing some text renderign from within the "minmax" function itself. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/profile.c b/profile.c
index c2433930f..9b91ca7b1 100644
--- a/profile.c
+++ b/profile.c
@@ -113,6 +113,27 @@ 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)
+{
+ 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;
+ double d;
+
+ switch (output_units.length) {
+ case METERS:
+ d = depth.mm / 1000.0;
+ fmt = "%.1f";
+ break;
+ case FEET:
+ d = to_feet(depth);
+ fmt = "%.0f";
+ break;
+ }
+ plot_text(gc, &tro, sec, depth.mm, fmt, d);
+}
+
/*
* Find the next minimum/maximum point.
*
@@ -160,27 +181,6 @@ static struct sample *next_minmax(struct sample *sample, struct sample *end, int
return result;
}
-static void render_depth_sample(struct graphics_context *gc, struct sample *sample)
-{
- 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;
- double d;
-
- switch (output_units.length) {
- case METERS:
- d = depth.mm / 1000.0;
- fmt = "%.1f";
- break;
- case FEET:
- d = to_feet(depth);
- fmt = "%.0f";
- break;
- }
- plot_text(gc, &tro, sec, depth.mm, fmt, d);
-}
-
static void plot_text_samples(struct graphics_context *gc, struct sample *a, struct sample *b)
{
for (;;) {
@@ -188,7 +188,7 @@ static void plot_text_samples(struct graphics_context *gc, struct sample *a, str
break;
a = next_minmax(a, b, 1);
if (!a)
- return;
+ break;
render_depth_sample(gc, a);
a = next_minmax(a, b, 0);
if (!a)