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
5
hardMarginY = ceill(page->convertToYResolution(request.printer()->
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);
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 +
29
+ for (unsigned int x=0; x < lineWidthInB - hardMarginXInB; x++) {
30
+ band[x * bandHeight + y] = planes[i][index + x +
31
+ hardMarginXInB + y * lineWidthInB];
33
+ for (unsigned int x=lineWidthInB - hardMarginXInB; x < lineWidthInB; x++)
34
+ band[x * bandHeight + y] = 0;
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 +
42
+ for (unsigned int x=0; x < lineWidthInB - hardMarginXInB; x++) {
43
+ band[x + y * (lineWidthInB - hardMarginXInB)] = planes[i][index + x +
44
+ hardMarginXInB + y * lineWidthInB];
46
+ for (unsigned int x=lineWidthInB - hardMarginXInB; x < lineWidthInB; x++)
47
+ band[x + y * (lineWidthInB - hardMarginXInB)] = 0;
51
// Does the band is empty?
52
- if (_isEmptyBand(band, bandSize))
54
+ if (_isEmptyBand(band, bandSize))
57
// Check if bytes have to be reversed
58
if (algo.inverseByte())
61
page->registerBand(current);
63
- index += bandSize + localHeight * hardMarginXInB;
65
pageHeight = theEnd ? 0 : pageHeight - bandHeight;
69
static bool _compressWholePage(const Request& request, Page* page)
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;
78
printer()->hardMarginX())) + 7) & ~7;
79
hardMarginY = ceill(page->convertToYResolution(request.printer()->
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];
99
unsigned char *curPlane = page->planeBuffer(i);
102
- index = hardMarginY * (lineWidthInB + hardMarginXInB) +
103
+ index = hardMarginY * (lineWidthInB + 2 * 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];
113
// Call the compression method
114
plane = algo[i].compress(request, buffer, page->width(),
118
plane->setColorNr(i + 1);
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
124
index = pageWidthInB * ((pageHeight - documentHeight)/2);
126
documentHeight -= clippingY;
127
+ pageHeight -= 2*marginHeight;
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);
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
144
// Make rotation on even pages for ManualLongEdge duplex mode
145
- if (rotateEvenPages) {
146
- if (page->pageNr() % 2)
147
- rotateEvenPages = false;
150
+ if (rotateEvenPages && !(page->pageNr() % 2)) {
154
// Apply some colors optimizations
157
fprintf(stderr, "PAGE: %lu %lu\n", page->pageNr(), page->copiesNr());
160
page = getNextPage();
165
ERRORMSG(_("Error while compressing the page. Check the previous "
166
"message. Trying to print the other pages."));
168
fprintf(stderr, "PAGE: %lu %lu\n", page->pageNr(), page->copiesNr());
170
page = document.getNextRawPage(request);