+ last = sec;
+ plot_single_temp_text(gc,sec,mkelvin);
+ last_printed_temp = mkelvin;
+ }
+ /* it would be nice to print the end temperature, if it's different */
+ if (last_temperature != last_printed_temp)
+ plot_single_temp_text(gc, last, last_temperature);
+}
+
+static void plot_temperature_profile(struct dive *dive, struct graphics_context *gc,
+ struct plot_info *pi)
+{
+ int i;
+ cairo_t *cr = gc->cr;
+ int last = 0;
+
+ if (!setup_temperature_limits(gc, pi))
+ return;
+
+ set_source_rgba(gc, 0.2, 0.2, 1.0, 0.8);
+ for (i = 0; i < dive->samples; i++) {
+ struct sample *sample = dive->sample+i;
+ if (sample->time.seconds > dive->duration.seconds)
+ break; /* let's not plot surface temp events */
+ int mkelvin = sample->temperature.mkelvin;
+ if (!mkelvin) {
+ if (!last)
+ continue;
+ mkelvin = last;
+ }
+ if (last)
+ line_to(gc, sample->time.seconds, mkelvin);
+ else
+ move_to(gc, sample->time.seconds, mkelvin);
+ last = mkelvin;