summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-10 09:23:19 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-10 11:54:14 +0100
commit7db08ae1283bab866931fef8f9820366e6b66b5d (patch)
tree0ec0cca0c716fbea65386c2cdccb9abd79895684
parent097702a39216311b2f2e32d56f66318ba9f0d34a (diff)
downloadsubsurface-7db08ae1283bab866931fef8f9820366e6b66b5d.tar.gz
Instead of the ugly red boxes make the surface come down to ceiling
Based on suggestions from Linus (and a few iterations) we now simply have the surface (i.e., background color / pattern) come down to where the ceiling is. And we only do the angry red shading when the diver violates the ceiling. I think this looks much better. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/profile.c b/profile.c
index c6ab46649..e20527986 100644
--- a/profile.c
+++ b/profile.c
@@ -843,7 +843,6 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
struct plot_data *entry;
int maxtime, maxdepth, marker;
int increments[8] = { 10, 20, 30, 60, 5*60, 10*60, 15*60, 30*60 };
- gboolean plotting = FALSE;
/* Get plot scaling limits */
maxtime = get_maxtime(pi);
@@ -935,8 +934,37 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
move_to(gc, 0, 0);
for (i = 0; i < pi->nr; i++, entry++)
line_to(gc, entry->sec, entry->depth);
+
+ /* Show any ceiling we may have encountered */
+ for (i = pi->nr - 1; i >= 0; i--, entry--) {
+ if (entry->ceiling < entry->depth) {
+ line_to(gc, entry->sec, entry->ceiling);
+ } else {
+ line_to(gc, entry->sec, entry->depth);
+ }
+ }
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);
+ pattern_add_color_stop_rgba (gc, pat, 1, 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++)
+ line_to(gc, entry->sec, entry->depth);
+
+ for (i = pi->nr - 1; i >= 0; i--, entry--) {
+ if (entry->ceiling > entry->depth) {
+ line_to(gc, entry->sec, entry->ceiling);
+ } else {
+ line_to(gc, entry->sec, entry->depth);
+ }
+ }
+ cairo_close_path(gc->cr);
cairo_fill(gc->cr);
/* Now do it again for the velocity colors */
@@ -953,36 +981,6 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi
line_to(gc, sec, depth);
cairo_stroke(cr);
}
-
- /* now on top of this the ceiling plot */
- entry = pi->entry;
- pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0 * plot_scale);
- pattern_add_color_stop_rgba (gc, pat, 0.5, CEILING_DEEP);
- pattern_add_color_stop_rgba (gc, pat, 0, CEILING_SHALLOW);
- cairo_set_source(gc->cr, pat);
- cairo_pattern_destroy(pat);
- cairo_set_line_width_scaled(gc->cr, 2);
- for (i = 0; i < pi->nr; i++, entry++) {
- if (entry->ceiling > 0) {
- if (!plotting) {
- move_to(gc, entry->sec, 0);
- plotting = TRUE;
- }
- line_to(gc, entry->sec, entry->ceiling);
- } else {
- if (plotting) {
- line_to(gc, entry->sec, 0);
- cairo_close_path(gc->cr);
- cairo_fill(gc->cr);
- plotting = FALSE;
- }
- }
- }
- if (plotting) {
- line_to(gc, entry->sec, 0);
- cairo_close_path(gc->cr);
- cairo_fill(gc->cr);
- }
}
static int setup_temperature_limits(struct graphics_context *gc, struct plot_info *pi)