Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2009-10-24 06:41:48 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2009-10-25 11:57:38 (GMT)
commitf3d53dc0f9d9454e5b7f6dc0f7a209434bd9adfb (patch)
tree11a4c693676ce003448783835be5688c3cf34f47
parent45d029cd41717bce71de267f862c197e134f26ab (diff)
[printing] Preserve aspect ratio when scaling page for printing
Fixes bgo#599468.
-rw-r--r--shell/ev-print-operation.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/shell/ev-print-operation.c b/shell/ev-print-operation.c
index eb0f9be..8dbe6c5 100644
--- a/shell/ev-print-operation.c
+++ b/shell/ev-print-operation.c
@@ -1649,7 +1649,7 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
EvPrintOperation *op = EV_PRINT_OPERATION (print);
cairo_t *cr;
gdouble cr_width, cr_height;
- gdouble width, height;
+ gdouble width, height, scale;
gtk_print_operation_set_defer_drawing (print->op);
@@ -1670,7 +1670,11 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
cr_height = gtk_print_context_get_height (context);
ev_document_get_page_size (op->document, page,
&width, &height);
- cairo_scale (cr, cr_width / width, cr_height / height);
+ if (cr_width / width < cr_height / height)
+ scale = cr_width / width;
+ else
+ scale = cr_height / height;
+ cairo_scale (cr, scale, scale);
ev_job_print_set_cairo (EV_JOB_PRINT (print->job_print), cr);
ev_job_scheduler_push_job (print->job_print, EV_JOB_PRIORITY_NONE);