aboutsummaryrefslogtreecommitdiffstats
path: root/main/tiff/tiff2pdf-compression.patch
blob: 2dae2dcd1cb3873e410ba4e4a3eb90dab402c736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- tiff-3.8.2/tools/tiff2pdf.c	8 Jun 2006 11:27:11 -0000	1.35
+++ tiff-3.8.2/tools/tiff2pdf.c	19 Jun 2006 20:12:08 -0000	1.36
@@ -937,7 +937,7 @@
 
 #ifdef JPEG_SUPPORT
 	if(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){
-		if(t2p->pdf_defaultcompressionquality<100 ||
+		if(t2p->pdf_defaultcompressionquality>100 ||
 			t2p->pdf_defaultcompressionquality<1){
 			t2p->pdf_defaultcompressionquality=0;
 		}
@@ -945,25 +945,17 @@
 #endif
 #ifdef ZIP_SUPPORT
 	if(t2p->pdf_defaultcompression==T2P_COMPRESS_ZIP){
-		switch (t2p->pdf_defaultcompressionquality){
-			case 1: case 10: case 11: case 12: case 13: case 14: case 15:
-			case 101: case 110: case 111: case 112: case 113: case 114: case 115:
-			case 201: case 210: case 211: case 212: case 213: case 214: case 215:
-			case 301: case 310: case 311: case 312: case 313: case 314: case 315:
-			case 401: case 410: case 411: case 412: case 413: case 414: case 415:
-			case 501: case 510: case 511: case 512: case 513: case 514: case 515:
-			case 601: case 610: case 611: case 612: case 613: case 614: case 615:
-			case 701: case 710: case 711: case 712: case 713: case 714: case 715:
-			case 801: case 810: case 811: case 812: case 813: case 814: case 815:
-			case 901: case 910: case 911: case 912: case 913: case 914: case 915:
-				break;
-			default:
-				t2p->pdf_defaultcompressionquality=0;
+ 		uint16 m=t2p->pdf_defaultcompressionquality%100;
+ 		if(t2p->pdf_defaultcompressionquality/100 > 9 ||
+ 			(m>1 && m<10) || m>15){
+ 			t2p->pdf_defaultcompressionquality=0;
 		}
 		if(t2p->pdf_defaultcompressionquality%100 !=0){
+ 			t2p->pdf_defaultcompressionquality/=100;
+ 			t2p->pdf_defaultcompressionquality*=100;
 			TIFFError(
 				TIFF2PDF_MODULE, 
-				"PNG Group predictor differencing not implemented, assuming compresion quality %u", 
+				"PNG Group predictor differencing not implemented, assuming compression quality %u", 
 				t2p->pdf_defaultcompressionquality);
 		}
 		t2p->pdf_defaultcompressionquality%=100;