~ubuntu-branches/ubuntu/oneiric/poppler/oneiric-security

« back to all changes in this revision

Viewing changes to debian/patches/20_fix-slowness-on-evince-output-lp-680628.patch

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-01-04 20:50:23 UTC
  • Revision ID: james.westby@ubuntu.com-20110104205023-pkptq4zwgn5yqwmx
Tags: 0.14.5-0ubuntu3
* debian/patches/poppler-bug-32746.patch: Backported fix for upstream bug
  #32746, at some PDF files some color images appear in grayscale or not
  at all when printing to PDF with evince.
* debian/patches/20_fix-slowness-on-evince-output-lp-680628.patch:
  Re-introduced patch from 0.14.3-0ubuntu2, it did not actually make it into
  upstream 0.14.5 (LP: #680628).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Nur -x '*.orig' -x '*~' poppler-0.14.3//poppler/CairoOutputDev.cc poppler-0.14.3.new//poppler/CairoOutputDev.cc
 
2
--- poppler-0.14.3//poppler/CairoOutputDev.cc   2010-07-13 00:19:57.000000000 +0200
 
3
+++ poppler-0.14.3.new//poppler/CairoOutputDev.cc       2010-12-07 17:07:58.920388022 +0100
 
4
@@ -1564,7 +1564,7 @@
 
5
   unsigned char *dest;
 
6
   cairo_surface_t *image;
 
7
   cairo_pattern_t *pattern;
 
8
-  int x, y;
 
9
+  int x, y, i, bit;
 
10
   ImageStream *imgStr;
 
11
   Guchar *pix;
 
12
   cairo_matrix_t matrix;
 
13
@@ -1576,7 +1576,7 @@
 
14
   imgStr = new ImageStream(str, width, 1, 1);
 
15
   imgStr->reset();
 
16
 
 
17
-  image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
 
18
+  image = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
 
19
   if (cairo_surface_status (image))
 
20
     goto cleanup;
 
21
 
 
22
@@ -1588,12 +1588,23 @@
 
23
   for (y = 0; y < height; y++) {
 
24
     pix = imgStr->getLine();
 
25
     dest = buffer + y * row_stride;
 
26
+    i = 0;
 
27
+    bit = 0;
 
28
     for (x = 0; x < width; x++) {
 
29
-
 
30
-      if (pix[x] ^ invert_bit)
 
31
-       *dest++ = 0;
 
32
-      else
 
33
-       *dest++ = 255;
 
34
+      if (bit == 0)
 
35
+       dest[i] = 0;
 
36
+      if (!(pix[x] ^ invert_bit)) {
 
37
+#ifdef WORDS_BIGENDIAN
 
38
+       dest[i] |= (1 << (7 - bit));
 
39
+#else
 
40
+       dest[i] |= (1 << bit);
 
41
+#endif
 
42
+      }
 
43
+      bit++;
 
44
+      if (bit > 7) {
 
45
+       bit = 0;
 
46
+       i++;
 
47
+      }
 
48
     }
 
49
   }
 
50