evince/tiff.patch
2007-11-16 04:06:24 +00:00

34 lines
1.1 KiB
Diff

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,