aboutsummaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-04 12:14:26 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-04 12:14:26 -0700
commitb72ade0e78825dd97add4c7607c574df351abed0 (patch)
tree6e50f25b3e794ade420e21c6e9ce1c2b98ba1a34 /print.c
parentd7e35c512c4a4d6691c7c1312691c17cce4c684e (diff)
downloadsubsurface-b72ade0e78825dd97add4c7607c574df351abed0.tar.gz
Change plot routine to take a drawing_area as argument
Previously we passed in width and height and the routine itself decided to keep 5% margin around each edge - oddly doing this with double precision, even though this is all integer coordinates. Instead we are now passing in a drawing_area. We are kind of abusing the cairo_rectangle_int_t data type here - but it seemed silly to redefine a new data type for this. Width and height give the size of the TOTAL drawing area (as before). x and y give the offset from the edges - so the EFFECTIVE drawing area is width-2x and height-2y This is in preparation for adding tooltips - those need to know the coordinate offsets from the edges - so having this hard coded inside the plot function didn't make sense anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'print.c')
-rw-r--r--print.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/print.c b/print.c
index 36ceca67e..bdebcfe15 100644
--- a/print.c
+++ b/print.c
@@ -127,12 +127,13 @@ static void show_dive_text(struct dive *dive, cairo_t *cr, double w, double h, P
static void show_dive_profile(struct dive *dive, cairo_t *cr, double w, double h)
{
+ cairo_rectangle_int_t drawing_area = { w/20.0, h/20.0, w, h};
struct graphics_context gc = {
.printer = 1,
.cr = cr
};
cairo_save(cr);
- plot(&gc, w, h, dive);
+ plot(&gc, &drawing_area, dive);
cairo_restore(cr);
}