diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-02 22:45:21 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-03 20:43:19 -0800 |
commit | aab67e2a5bb9c74fcc60af4ade0192d31263ebc7 (patch) | |
tree | ee21d820f993fd29fe09b627d8d7d8a0351599ba /profile.c | |
parent | 3c31d0401dd9e4be2aa51e1bb2b72e0bc162cb9d (diff) | |
download | subsurface-aab67e2a5bb9c74fcc60af4ade0192d31263ebc7.tar.gz |
Add configurable visualization of calculated ceiling
This is on top of the deco information reported by the dive computer (in a
different color - currently ugly green). The user needs to enable this via
the Tec page of the preferences.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -78,7 +78,7 @@ typedef enum { TEXT_BACKGROUND, ALERT_BG, ALERT_FG, EVENTS, SAMPLE_DEEP, SAMPLE_SHALLOW, SMOOTHED, MINUTE, TIME_GRID, TIME_TEXT, DEPTH_GRID, MEAN_DEPTH, DEPTH_TOP, DEPTH_BOTTOM, TEMP_TEXT, TEMP_PLOT, SAC_DEFAULT, BOUNDING_BOX, PRESSURE_TEXT, BACKGROUND, - CEILING_SHALLOW, CEILING_DEEP + CEILING_SHALLOW, CEILING_DEEP, CALC_CEILING_SHALLOW, CALC_CEILING_DEEP } color_indice_t; typedef struct { @@ -136,6 +136,8 @@ static const color_t profile_color[] = { [BACKGROUND] = {{SPRINGWOOD1, BLACK1_LOW_TRANS}}, [CEILING_SHALLOW] = {{REDORANGE1_HIGH_TRANS, REDORANGE1_HIGH_TRANS}}, [CEILING_DEEP] = {{RED1_MED_TRANS, RED1_MED_TRANS}}, + [CALC_CEILING_SHALLOW] = {{FUNGREEN1_HIGH_TRANS, FUNGREEN1_HIGH_TRANS}}, + [CALC_CEILING_DEEP] = {{APPLE1_HIGH_TRANS, APPLE1_HIGH_TRANS}}, }; @@ -807,6 +809,24 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi cairo_close_path(gc->cr); cairo_fill(gc->cr); } + /* finally, plot the calculated ceiling over all this */ + if (prefs.profile_calc_ceiling) { + pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale); + pattern_add_color_stop_rgba (gc, pat, 0, CALC_CEILING_SHALLOW); + pattern_add_color_stop_rgba (gc, pat, 1, CALC_CEILING_DEEP); + cairo_set_source(gc->cr, pat); + cairo_pattern_destroy(pat); + entry = pi->entry; + move_to(gc, 0, 0); + for (i = 0; i < pi->nr; i++, entry++) { + if (entry->ceiling) + line_to(gc, entry->sec, entry->ceiling); + else + line_to(gc, entry->sec, 0); + } + cairo_close_path(gc->cr); + cairo_fill(gc->cr); + } /* next show where we have been bad and crossed the ceiling */ pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale); pattern_add_color_stop_rgba (gc, pat, 0, CEILING_SHALLOW); |