Update to 3.15.90

This commit is contained in:
Marek Kasik 2015-02-19 13:38:07 +01:00
parent 1c6633e890
commit e33cbf47d1
4 changed files with 8 additions and 130 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ evince-3.0.0.tar.bz2
/evince-3.14.0.tar.xz
/evince-3.14.1.tar.xz
/evince-3.15.4.tar.xz
/evince-3.15.90.tar.xz

View File

@ -1,122 +0,0 @@
From ae7a5715131613955a37419b5da1d6d9f3c1cb1d Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <cgarcia@igalia.com>
Date: Thu, 14 Aug 2014 14:07:05 +0200
Subject: [PATCH] print-operation: Fix centering of documents when printing
with a manual scale
When a manual scale is used for printing, the document is not correctly
centered because the cairo context has a scale already applied. We need
to consider the current scale when centering the page and also convert
the coordinates before the cairo_translate().
https://bugzilla.gnome.org/show_bug.cgi?id=734788
---
libview/ev-print-operation.c | 60 +++++++++++++++++++++++++++++++-------------
1 file changed, 42 insertions(+), 18 deletions(-)
diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c
index 8d5aa39..4a268b4 100644
--- a/libview/ev-print-operation.c
+++ b/libview/ev-print-operation.c
@@ -1825,6 +1825,27 @@ _print_context_get_hard_margins (GtkPrintContext *context,
}
static void
+ev_print_operation_print_get_scaled_page_size (EvPrintOperationPrint *print,
+ gint page,
+ gdouble *width,
+ gdouble *height)
+{
+ GtkPrintSettings *settings;
+ gdouble manual_scale;
+
+ ev_document_get_page_size (EV_PRINT_OPERATION (print)->document,
+ page, width, height);
+
+ settings = gtk_print_operation_get_print_settings (print->op);
+ manual_scale = gtk_print_settings_get_scale (settings) / 100.0;
+ if (manual_scale == 1.0)
+ return;
+
+ *width *= manual_scale;
+ *height *= manual_scale;
+}
+
+static void
ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
GtkPrintContext *context,
gint page)
@@ -1834,6 +1855,7 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
gdouble cr_width, cr_height;
gdouble width, height, scale;
gdouble x_scale, y_scale;
+ gdouble x_offset, y_offset;
gdouble top, bottom, left, right;
gtk_print_operation_set_defer_drawing (print->op);
@@ -1857,12 +1879,16 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
cr = gtk_print_context_get_cairo_context (context);
cr_width = gtk_print_context_get_width (context);
cr_height = gtk_print_context_get_height (context);
- ev_document_get_page_size (op->document, page, &width, &height);
+ ev_print_operation_print_get_scaled_page_size (print, page, &width, &height);
if (print->page_scale == EV_SCALE_NONE) {
/* Center document page on the printed page */
- if (print->autorotate)
- cairo_translate (cr, (cr_width - width) / 2, (cr_height - height) / 2);
+ if (print->autorotate) {
+ x_offset = (cr_width - width) / 2;
+ y_offset = (cr_height - height) / 2;
+ cairo_device_to_user (cr, &x_offset, &y_offset);
+ cairo_translate (cr, x_offset, y_offset);
+ }
} else {
_print_context_get_hard_margins (context, &top, &bottom, &left, &right);
@@ -1875,29 +1901,27 @@ ev_print_operation_print_draw_page (EvPrintOperationPrint *print,
scale = 1.0;
if (print->autorotate) {
- double left_right_sides, top_bottom_sides;
-
- cairo_translate (cr, (cr_width - scale * width) / 2,
- (cr_height - scale * height) / 2);
+ x_offset = (cr_width - scale * width) / 2;
+ y_offset = (cr_height - scale * height) / 2;
+ cairo_device_to_user (cr, &x_offset, &y_offset);
+ cairo_translate (cr, x_offset, y_offset);
/* Ensure document page is within the margins. The
* scale guarantees the document will fit in the
* margins so we just need to check each side and
* if it overhangs the margin, translate it to the
- * margin. */
- left_right_sides = (cr_width - width*scale)/2;
- top_bottom_sides = (cr_height - height*scale)/2;
- if (left_right_sides < left)
- cairo_translate (cr, left - left_right_sides, 0);
+ * margin. */
+ if (x_offset < left)
+ cairo_translate (cr, left - x_offset, 0);
- if (left_right_sides < right)
- cairo_translate (cr, -(right - left_right_sides), 0);
+ if (x_offset < right)
+ cairo_translate (cr, -(right - x_offset), 0);
- if (top_bottom_sides < top)
- cairo_translate (cr, 0, top - top_bottom_sides);
+ if (y_offset < top)
+ cairo_translate (cr, 0, top - y_offset);
- if (top_bottom_sides < bottom)
- cairo_translate (cr, 0, -(bottom - top_bottom_sides));
+ if (y_offset < bottom)
+ cairo_translate (cr, 0, -(bottom - y_offset));
} else {
cairo_translate (cr, left, top);
}
--
2.1.0

View File

@ -4,17 +4,14 @@
%global gxps_version 0.2.1
Name: evince
Version: 3.15.4
Release: 2%{?dist}
Version: 3.15.90
Release: 1%{?dist}
Summary: Document viewer
License: GPLv2+ and GPLv3+ and LGPLv2+ and MIT and Afmparse
Group: Applications/Publishing
URL: http://projects.gnome.org/evince/
Source0: http://download.gnome.org/sources/%{name}/3.14/%{name}-%{version}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=1173832
Patch0: 0001-print-operation-Fix-centering-of-documents-when-prin.patch
Source0: http://download.gnome.org/sources/%{name}/3.15/%{name}-%{version}.tar.xz
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gtk3-devel >= %{gtk3_version}
@ -123,7 +120,6 @@ This package contains the evince web browser plugin.
%prep
%setup -q
%patch0 -p1 -R -b .centering-of-printing
%build
./autogen.sh
@ -257,6 +253,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas >&/dev/null ||:
%{_libdir}/mozilla/plugins/libevbrowserplugin.so
%changelog
* Thu Feb 19 2015 Marek Kasik <mkasik@redhat.com> - 3.15.90-1
- Update to 3.15.90
* Wed Jan 21 2015 Marek Kasik <mkasik@redhat.com> - 3.15.4-2
- Revert fix of centering of documents when printing with a manual scale.
- This caused problems with printing of landscape documents.

View File

@ -1 +1 @@
c7decc638f3bf2d2f978f7149cf9c2ac evince-3.15.4.tar.xz
8aa81e7cf9a24cd122104e2f6945b27c evince-3.15.90.tar.xz