[PATCH] Calculate dive maxima/minima independent of dive computer
Linus Torvalds
torvalds at linux-foundation.org
Tue Dec 11 08:33:58 PST 2012
On Tue, 11 Dec 2012, Linus Torvalds wrote:
>
> This allows me to plot all dive computer data on top of each other, and
> the end result makes sense because they are all scaled to the same scale.
>
> I'll send out a hacky patch to let people play with that "plot everything
> on top of each other", but I doubt it's the right thing to do. I think we
> want some widget in a corner to select the dive computer or something.
> We'll see. But this uniform scaling is needed regardless, otherwise the
> plot will "jump" when you switch the display to another dive computer.
Here's the hacky "plot every dive computer of a dive on top of each other"
patch, just in case people want to see the multi-dive-computer data right
now.
Don't apply.
Linus
---
profile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/profile.c b/profile.c
index 047767ebd713..dc3bf915e633 100644
--- a/profile.c
+++ b/profile.c
@@ -2038,6 +2038,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
gc->maxx = (drawing_area->width - 2*drawing_area->x);
gc->maxy = (drawing_area->height - 2*drawing_area->y);
+do {
/* This is per-dive-computer. Right now we just do the first one */
pi = create_plot_info(dive, dc, gc);
@@ -2055,6 +2056,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
plot_temperature_text(gc, pi);
plot_depth_text(gc, pi);
plot_cylinder_pressure_text(gc, pi);
+} while ((dc = dc->next) != NULL);
/* Bounding box last */
gc->leftx = 0; gc->rightx = 1.0;
@@ -2070,6 +2072,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
cairo_stroke(gc->cr);
/* Put the dive computer name in the lower left corner */
+if (dc)
if (dc->model) {
static const text_render_options_t computer = {10, TIME_TEXT, LEFT, MIDDLE};
plot_text(gc, &computer, 0, 1, "%s", dc->model);
More information about the subsurface
mailing list