-/* Scale to 0,0 -> maxx,maxy */
-#define SCALE(x,y) (x)*maxx/scalex,(y)*maxy/scaley
+static void render_depth_sample(struct graphics_context *gc, struct sample *sample)
+{
+ text_render_options_t tro = {1.0, 0.2, 0.2, CENTER};
+ 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);
+}
+
+
+void plot_text_samples(struct dive *dive, struct graphics_context *gc,
+ struct sample *a, struct sample *b)
+{
+ struct sample *max, *min;
+
+ if (b < a)
+ return;
+ if (b->time.seconds - a->time.seconds < 3*60)
+ return;
+
+ max = next_minmax(a, b, 1);
+ if (max) {
+ render_depth_sample(gc, max);
+ min = next_minmax(max, b, 0);
+ if (min) {
+ plot_text_samples(dive, gc, min, b);
+ return;
+ }
+ }
+}