~ubuntu-branches/ubuntu/natty/splix/natty

« back to all changes in this revision

Viewing changes to debian/patches/all-papersize-fixes-from-svn.patch

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2008-11-26 09:19:45 UTC
  • Revision ID: james.westby@ubuntu.com-20081126091945-0nhjdarw7f8raiq8
Tags: 2.0.0~rc2-0ubuntu6
* debian/patches/all-papersize-fixes-from-svn.patch: Applied all paper-size-
  related fixes from the SVN repository up to November 25 (LP: #292690).
* debian/patches/no-crash-on-bad-papersize.patch: Removed, merged into
  all-papersize-fixes-from-svn.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Nur -x '*.orig' -x '*~' splix-2.0.0~rc2/src/compress.cpp splix-2.0.0~rc2.new/src/compress.cpp
 
2
--- splix-2.0.0~rc2/src/compress.cpp    2008-06-15 11:53:27.000000000 +0200
 
3
+++ splix-2.0.0~rc2.new/src/compress.cpp        2008-11-26 09:14:14.000000000 +0100
 
4
@@ -61,14 +61,14 @@
 
5
     hardMarginY = ceill(page->convertToYResolution(request.printer()->
 
6
         hardMarginY()));
 
7
     hardMarginXInB = hardMarginX / 8;
 
8
-    pageWidth = page->width() - hardMarginX;
 
9
+    pageWidth = page->width();
 
10
     pageHeight = page->height() - hardMarginY;
 
11
     page->setWidth(pageWidth);
 
12
     page->setHeight(pageHeight);
 
13
     lineWidthInB = (pageWidth + 7) / 8;
 
14
     bandHeight = request.printer()->bandHeight();
 
15
     bandSize = lineWidthInB * bandHeight;
 
16
-    index = hardMarginY * (lineWidthInB + hardMarginXInB);
 
17
+    index = hardMarginY * lineWidthInB;
 
18
     band = new unsigned char[bandSize];
 
19
     for (unsigned int i=0; i < colors; i++)
 
20
         planes[i] = page->planeBuffer(i);
 
21
@@ -101,25 +101,27 @@
 
22
             // Copy the data into the band depending on the algorithm options
 
23
             if (algo.reverseLineColumn()) {
 
24
                 for (unsigned int y=0; y < localHeight; y++) {
 
25
-                    for (unsigned int x=0; x < lineWidthInB; x++) {
 
26
-                            band[x * bandHeight + y] = planes[i][index + x +
 
27
-                                hardMarginXInB + y * (lineWidthInB + 
 
28
-                                hardMarginXInB)];
 
29
+                    for (unsigned int x=0; x < lineWidthInB - hardMarginXInB; x++) {
 
30
+                        band[x * bandHeight + y] = planes[i][index + x +
 
31
+                            hardMarginXInB + y * lineWidthInB];
 
32
                     }
 
33
+                    for (unsigned int x=lineWidthInB - hardMarginXInB; x < lineWidthInB; x++)
 
34
+                        band[x * bandHeight + y] = 0;
 
35
                 }
 
36
             } else {
 
37
                 for (unsigned int y=0; y < localHeight; y++) {
 
38
-                    for (unsigned int x=0; x < lineWidthInB; x++) {
 
39
-                            band[x + y * lineWidthInB] = planes[i][index + x +
 
40
-                                hardMarginXInB + y * (lineWidthInB + 
 
41
-                                hardMarginXInB)];
 
42
+                    for (unsigned int x=0; x < lineWidthInB - hardMarginXInB; x++) {
 
43
+                        band[x + y * (lineWidthInB - hardMarginXInB)] = planes[i][index + x +
 
44
+                            hardMarginXInB + y * lineWidthInB];
 
45
                     }
 
46
+                    for (unsigned int x=lineWidthInB - hardMarginXInB; x < lineWidthInB; x++)
 
47
+                        band[x + y * (lineWidthInB - hardMarginXInB)]  = 0;
 
48
                 }
 
49
             }
 
50
 
 
51
             // Does the band is empty?
 
52
-             if (_isEmptyBand(band, bandSize))
 
53
-                 continue;
 
54
+            if (_isEmptyBand(band, bandSize))
 
55
+                continue;
 
56
 
 
57
             // Check if bytes have to be reversed
 
58
             if (algo.inverseByte())
 
59
@@ -138,7 +140,7 @@
 
60
         if (current)
 
61
             page->registerBand(current);
 
62
         bandNumber++;
 
63
-        index += bandSize + localHeight * hardMarginXInB;
 
64
+        index += bandSize;
 
65
         pageHeight = theEnd ? 0 : pageHeight - bandHeight;
 
66
     }
 
67
     page->flushPlanes();
 
68
@@ -151,7 +153,7 @@
 
69
 static bool _compressWholePage(const Request& request, Page* page)
 
70
 {
 
71
     unsigned long hardMarginX, hardMarginXInB, hardMarginY, lineWidthInB;
 
72
-    unsigned long pageWidth, pageHeight, index;
 
73
+    unsigned long pageWidth, bandHeight, planeHeight, pageHeight, index;
 
74
     unsigned long bandNumber=0;
 
75
     unsigned char *buffer;
 
76
     Band *current = NULL;
 
77
@@ -161,14 +163,16 @@
 
78
         printer()->hardMarginX())) + 7) & ~7;
 
79
     hardMarginY = ceill(page->convertToYResolution(request.printer()->
 
80
         hardMarginY()));
 
81
-//    hardMarginX = hardMarginY = 0;
 
82
     hardMarginXInB = hardMarginX / 8;
 
83
-    pageWidth = page->width() - hardMarginX;
 
84
-    pageHeight = page->height() - hardMarginY;
 
85
+    pageWidth = page->width() - hardMarginX * 2;
 
86
+    pageHeight = page->height() - hardMarginY * 2;
 
87
     page->setWidth(pageWidth);
 
88
     page->setHeight(pageHeight);
 
89
     lineWidthInB = (pageWidth + 7) / 8;
 
90
-    buffer = new unsigned char[lineWidthInB * pageHeight];
 
91
+    bandHeight = request.printer()->bandHeight();
 
92
+    // Alignment of the page height on band height
 
93
+    planeHeight = ((pageHeight + bandHeight - 1) / bandHeight) * bandHeight;
 
94
+    buffer = new unsigned char[lineWidthInB * planeHeight];
 
95
 
 
96
     do {
 
97
         current = NULL;
 
98
@@ -176,10 +180,10 @@
 
99
             unsigned char *curPlane = page->planeBuffer(i);
 
100
             BandPlane *plane;
 
101
 
 
102
-            index = hardMarginY * (lineWidthInB + hardMarginXInB) + 
 
103
+            index = hardMarginY * (lineWidthInB + 2 * hardMarginXInB) + 
 
104
                 hardMarginXInB;
 
105
             for (unsigned int y=0; y < pageHeight; y++, 
 
106
-                    index += hardMarginXInB) {
 
107
+                    index += 2 * hardMarginXInB) {
 
108
                 for (unsigned int x=0; x < lineWidthInB; x++, index++) {
 
109
                     buffer[x + y * lineWidthInB] = curPlane[index];
 
110
                 }
 
111
@@ -187,7 +191,7 @@
 
112
 
 
113
             // Call the compression method
 
114
             plane = algo[i].compress(request, buffer, page->width(), 
 
115
-                page->height());
 
116
+                planeHeight);
 
117
             if (plane) {
 
118
                 plane->setColorNr(i + 1);
 
119
                 if (!current)
 
120
diff -Nur -x '*.orig' -x '*~' splix-2.0.0~rc2/src/document.cpp splix-2.0.0~rc2.new/src/document.cpp
 
121
--- splix-2.0.0~rc2/src/document.cpp    2008-06-15 11:53:27.000000000 +0200
 
122
+++ splix-2.0.0~rc2.new/src/document.cpp        2008-11-26 09:13:59.000000000 +0100
 
123
@@ -129,8 +129,14 @@
 
124
         index = pageWidthInB * ((pageHeight - documentHeight)/2);
 
125
     }
 
126
     documentHeight -= clippingY;
 
127
+    pageHeight -= 2*marginHeight;
 
128
     clippingY *= colors;
 
129
     line = new unsigned char[header.cupsBytesPerLine];
 
130
+    DEBUGMSG(_("Document width=%lu height=%lu"), documentWidth, documentHeight);
 
131
+    DEBUGMSG(_("Page width=%lu (%lu) height=%lu"), pageWidth, pageWidthInB, pageHeight);
 
132
+    DEBUGMSG(_("Margin width in bytes=%lu height=%lu"), marginWidthInB, marginHeight);
 
133
+    DEBUGMSG(_("Clipping X=%lu Y=%lu"), clippingX, clippingY);
 
134
+    DEBUGMSG(_("Line size=%lu, Plane size=%lu, bytes to copy=%lu"), lineSize, planeSize, bytesToCopy);
 
135
 
 
136
     // Prepare planes and clip vertically the document if needed
 
137
     for (unsigned char i=0; i < colors; i++) {
 
138
diff -Nur -x '*.orig' -x '*~' splix-2.0.0~rc2/src/rendering.cpp splix-2.0.0~rc2.new/src/rendering.cpp
 
139
--- splix-2.0.0~rc2/src/rendering.cpp   2008-06-15 11:53:27.000000000 +0200
 
140
+++ splix-2.0.0~rc2.new/src/rendering.cpp       2008-11-26 09:13:44.000000000 +0100
 
141
@@ -62,11 +62,8 @@
 
142
         }
 
143
 
 
144
         // Make rotation on even pages for ManualLongEdge duplex mode
 
145
-        if (rotateEvenPages) {
 
146
-            if (page->pageNr() % 2)
 
147
-                rotateEvenPages = false;
 
148
-            else
 
149
-                page->rotate();
 
150
+        if (rotateEvenPages && !(page->pageNr() % 2)) {
 
151
+            page->rotate();
 
152
         }
 
153
 
 
154
         // Apply some colors optimizations
 
155
@@ -147,6 +144,7 @@
 
156
             }
 
157
             fprintf(stderr, "PAGE: %lu %lu\n", page->pageNr(), page->copiesNr());
 
158
         }
 
159
+        delete page;
 
160
         page = getNextPage();
 
161
     }
 
162
 
 
163
@@ -195,8 +193,8 @@
 
164
         } else
 
165
             ERRORMSG(_("Error while compressing the page. Check the previous "
 
166
                 "message. Trying to print the other pages."));
 
167
-        delete page;
 
168
         fprintf(stderr, "PAGE: %lu %lu\n", page->pageNr(), page->copiesNr());
 
169
+        delete page;
 
170
         page = document.getNextRawPage(request);
 
171
     }
 
172