mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use GTK_UNIT_INCH when printing to provide consistency across OS
Tests have shown that the most multi-platform way to do printing with GTK is to use GTK_UNIT_INCH (or GTK_UNIT_MM) with GtkPrintOperation. Tested on Linux, OSX, Windows. However this requires the appropriate scaling for Pango and Cairo to be done, with separate plotting logic for printing and drawing on the screen. To achieve that, profile.c:plot() now accepts a scaling parameter from type "scale_mode_t" defined in "display.h". Also due to new scale, small decimal numbers (such as 6.12345) cannot be well stored in "cairo_rectangle_int_t" therefore it is replaced with "cairo_rectangle_t", which uses doubles to provide Cairo with a drawing area. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Minor whitespace cleanup. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
38d49bf041
commit
50eac41129
4 changed files with 47 additions and 19 deletions
|
@ -1014,7 +1014,7 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer
|
|||
{
|
||||
struct dive *dive = current_dive;
|
||||
struct graphics_context gc = { .printer = 0 };
|
||||
static cairo_rectangle_int_t drawing_area;
|
||||
static cairo_rectangle_t drawing_area;
|
||||
|
||||
/* the drawing area gives TOTAL width * height - x,y is used as the topx/topy offset
|
||||
* so effective drawing area is width-2x * height-2y */
|
||||
|
@ -1035,7 +1035,7 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer
|
|||
tooltip_rects = NULL;
|
||||
}
|
||||
tooltips = 0;
|
||||
plot(&gc, &drawing_area, dive);
|
||||
plot(&gc, &drawing_area, dive, SC_SCREEN);
|
||||
}
|
||||
cairo_destroy(gc.cr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue