summaryrefslogtreecommitdiff
path: root/gtk/gtkprintcontext.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2012-09-12 11:34:09 +0200
committerMarek Kasik <mkasik@redhat.com>2012-09-12 15:38:37 +0200
commitdd7e8e9414ddd908c35ba3a8c07d3c554ed21a84 (patch)
treec0b98de286779897ae7147ed56a8d5ffc73d7293 /gtk/gtkprintcontext.c
parent2971446d580c996cccc47adfc23c099bc6f5013a (diff)
downloadgtk+-dd7e8e9414ddd908c35ba3a8c07d3c554ed21a84.tar.gz
Don't rotate pdf landscape output
Diffstat (limited to 'gtk/gtkprintcontext.c')
-rw-r--r--gtk/gtkprintcontext.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c
index 1de8f0c33f..4d55b75e78 100644
--- a/gtk/gtkprintcontext.c
+++ b/gtk/gtkprintcontext.c
@@ -286,6 +286,36 @@ _gtk_print_context_rotate_according_to_orientation (GtkPrintContext *context)
}
void
+_gtk_print_context_reverse_according_to_orientation (GtkPrintContext *context)
+{
+ cairo_t *cr = context->cr;
+ cairo_matrix_t matrix;
+ gdouble width, height;
+
+ width = gtk_page_setup_get_paper_width (context->page_setup, GTK_UNIT_INCH);
+ width = width * context->surface_dpi_x / context->pixels_per_unit_x;
+ height = gtk_page_setup_get_paper_height (context->page_setup, GTK_UNIT_INCH);
+ height = height * context->surface_dpi_y / context->pixels_per_unit_y;
+
+ switch (gtk_page_setup_get_orientation (context->page_setup))
+ {
+ default:
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ cairo_translate (cr, width, height);
+ cairo_matrix_init (&matrix,
+ -1, 0,
+ 0, -1,
+ 0, 0);
+ cairo_transform (cr, &matrix);
+ break;
+ }
+}
+
+void
_gtk_print_context_translate_into_margin (GtkPrintContext *context)
{
gdouble left, top;