Fix rendering of tiffs

This commit is contained in:
Matthias Clasen 2007-11-16 04:06:24 +00:00
parent 65389c39cf
commit 499c2ddc2c
2 changed files with 40 additions and 1 deletions

View File

@ -5,7 +5,7 @@
Name: evince
Version: 2.20.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Document viewer
License: GPLv2+ and GFDL+
@ -13,6 +13,8 @@ Group: Applications/Publishing
URL: http://www.gnome.org/projects/evince/
Source0: http://download.gnome.org/sources/%{name}/2.20/%{name}-%{version}.tar.bz2
Patch0: evince-0.6.0-print-error.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=497279
Patch1: tiff.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gtk2-devel >= %{gtk2_version}
@ -50,6 +52,7 @@ evince is a GNOME-based document viewer.
%prep
%setup -q
%patch0 -p1 -b .print-error
%patch1 -p1 -b .tiff
%build
intltoolize --force
@ -151,6 +154,9 @@ fi
%changelog
* Thu Nov 15 2007 Matthias Clasen <mclasen@redhat.com> - 2.20.1-3
- Fix rendering of tiff images (#385671)
* Tue Oct 23 2007 Matthias Clasen <mclasen@redhat.com> - 2.20.1-2
- Rebuild against new dbus-glib

33
tiff.patch Normal file
View File

@ -0,0 +1,33 @@
diff -up evince-2.20.1/backend/tiff/tiff-document.c.tiff evince-2.20.1/backend/tiff/tiff-document.c
--- evince-2.20.1/backend/tiff/tiff-document.c.tiff 2007-10-15 16:12:12.000000000 -0400
+++ evince-2.20.1/backend/tiff/tiff-document.c 2007-11-15 23:02:08.000000000 -0500
@@ -210,6 +210,7 @@ tiff_document_render (EvDocument *d
float x_res, y_res;
gint rowstride, bytes;
guchar *pixels = NULL;
+ guchar *p;
GdkPixbuf *pixbuf;
GdkPixbuf *scaled_pixbuf;
GdkPixbuf *rotated_pixbuf;
@@ -271,6 +272,21 @@ tiff_document_render (EvDocument *d
ORIENTATION_TOPLEFT, 1);
pop_handlers ();
+ /* Convert the format returned by libtiff to
+ * what cairo expects
+ */
+ while (p < pixels + bytes) {
+ uint32 pixel = *(uint32 *)p;
+ int r = TIFFGetR(pixel);
+ int g = TIFFGetG(pixel);
+ int b = TIFFGetB(pixel);
+ int a = TIFFGetA(pixel);
+ *p++ = b;
+ *p++ = g;
+ *p++ = r;
+ *p++ = a;
+ }
+
rotated_surface = ev_document_misc_surface_rotate_and_scale (surface,
(width * rc->scale) + 0.5,
(height * rc->scale * (x_res / y_res)) + 0.5,