X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkprintcontext.c;h=4d55b75e7858bbedfc07c522e5ea8ab054230e6c;hb=45ad8a06ad511ad95a74172172b9fe459bc666ad;hp=1de8f0c33f16861d6669aedf75fd3cb8b1ad0522;hpb=88c63903a5eeac40ef2cd210468705c20f580596;p=~andy%2Fgtk diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c index 1de8f0c33..4d55b75e7 100644 --- a/gtk/gtkprintcontext.c +++ b/gtk/gtkprintcontext.c @@ -285,6 +285,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) {