diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-31 14:23:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-31 14:23:35 -0700 |
commit | 059f047788a9549e448f6e9f108a9f55b81ee64c (patch) | |
tree | a6c87323bc2868ea893edc3a1d0af00a089e6cfb /profile.c | |
parent | eed9538101a97142d8327119b9539f847f818198 (diff) | |
download | subsurface-059f047788a9549e448f6e9f108a9f55b81ee64c.tar.gz |
plot a fancier 'filled' depth profile
Now I'm just dicking around with cairo.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -29,6 +29,7 @@ static void plot(cairo_t *cr, int w, int h, struct dive *dive, int samples, stru double topx, topy, maxx, maxy; double scalex, scaley; int maxtime, maxdepth; + int begins, sec, depth; topx = w / 20.0; topy = h / 20.0; @@ -63,11 +64,21 @@ static void plot(cairo_t *cr, int w, int h, struct dive *dive, int samples, stru /* Depth profile */ cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.80); + begins = sample->time.seconds; cairo_move_to(cr, SCALE(sample->time.seconds, to_feet(sample->depth))); for (i = 1; i < dive->samples; i++) { sample++; - cairo_line_to(cr, SCALE(sample->time.seconds, to_feet(sample->depth))); + sec = sample->time.seconds; + depth = to_feet(sample->depth); + cairo_line_to(cr, SCALE(sec, depth)); } + scaley = 1.0; + cairo_line_to(cr, SCALE(sec, 0)); + cairo_line_to(cr, SCALE(begins, 0)); + cairo_close_path(cr); + cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.20); + cairo_fill_preserve(cr); + cairo_set_source_rgba(cr, 1, 0.2, 0.2, 0.80); cairo_stroke(cr); /* Bounding box last */ |