[gtk+] printing: Fix origin for scaled, rotated pages
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] printing: Fix origin for scaled, rotated pages
- Date: Thu, 27 Nov 2014 11:21:52 +0000 (UTC)
commit c85c3510e70ea8396dde56606ac0380825c3732f
Author: Leo Wolf <jclw ymail com>
Date: Wed Nov 26 20:18:36 2014 +0000
printing: Fix origin for scaled, rotated pages
The calls to cairo_translate in
_gtk_print_context_rotate_according_to_orientation,
_gtk_print_context_reverse_according_to_orientation and
_gtk_print_context_translate_into_margin assume an unscaled context.
These functions should therefore be called before scaling the context,
otherwise the origin does not always end up in the top left corner.
https://bugzilla.gnome.org/show_bug.cgi?id=740742
gtk/gtkprintoperation.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index d13f6bc..1f45c4f 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -2488,17 +2488,22 @@ common_render_page (GtkPrintOperation *op,
cr = gtk_print_context_get_cairo_context (print_context);
cairo_save (cr);
- if (priv->manual_scale != 1.0 && priv->manual_number_up <= 1)
- cairo_scale (cr,
- priv->manual_scale,
- priv->manual_scale);
if (priv->manual_orientation)
_gtk_print_context_rotate_according_to_orientation (print_context);
else
_gtk_print_context_reverse_according_to_orientation (print_context);
- if (priv->manual_number_up > 1)
+ if (priv->manual_number_up <= 1)
+ {
+ if (!priv->use_full_page)
+ _gtk_print_context_translate_into_margin (print_context);
+ if (priv->manual_scale != 1.0)
+ cairo_scale (cr,
+ priv->manual_scale,
+ priv->manual_scale);
+ }
+ else
{
GtkPageOrientation orientation;
GtkPageSetup *page_setup;
@@ -2678,9 +2683,6 @@ common_render_page (GtkPrintOperation *op,
cairo_rotate (cr, - G_PI / 2);
}
}
- else
- if (!priv->use_full_page)
- _gtk_print_context_translate_into_margin (print_context);
priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_DRAWING;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]