Main GraphicsMagick source repository
Revision | 2771be055aa4e59b141cac06f512ca541fd86a8d (tree) |
---|---|
Time | 2005-04-02 08:50:18 |
Author | Bob Friesenhahn <bfriesen@Grap...> |
Commiter | Bob Friesenhahn |
* coders/pdf.c (WritePDFImage): Integrate fixes for Ghoscript 8.50
warning from the 1.1 branch.
@@ -1,5 +1,7 @@ | ||
1 | 1 | 2005-04-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
2 | 2 | |
3 | + * coders/pdf.c (WritePDFImage): Integrate fixes for Ghoscript 8.50 | |
4 | + warning from the 1.1 branch. | |
3 | 5 | * magick/tempfile.c (DestroyTemporaryFiles): Back port memory leak |
4 | 6 | fix from version 1.1. |
5 | 7 |
@@ -1013,7 +1013,11 @@ | ||
1013 | 1013 | (void) WriteBlobString(image,buffer); |
1014 | 1014 | switch (compression) |
1015 | 1015 | { |
1016 | - case NoCompression: FormatString(buffer,CFormat,"ASCII85Decode"); break; | |
1016 | + case NoCompression: | |
1017 | + { | |
1018 | + FormatString(buffer,CFormat,"ASCII85Decode"); | |
1019 | + break; | |
1020 | + } | |
1017 | 1021 | case JPEGCompression: |
1018 | 1022 | { |
1019 | 1023 | FormatString(buffer,CFormat,"DCTDecode"); |
@@ -1023,8 +1027,16 @@ | ||
1023 | 1027 | (void) strcpy(buffer,"/Decode [1 0 1 0 1 0 1 0]\n"); |
1024 | 1028 | break; |
1025 | 1029 | } |
1026 | - case LZWCompression: FormatString(buffer,CFormat,"LZWDecode"); break; | |
1027 | - case ZipCompression: FormatString(buffer,CFormat,"FlateDecode"); break; | |
1030 | + case LZWCompression: | |
1031 | + { | |
1032 | + FormatString(buffer,CFormat,"LZWDecode"); | |
1033 | + break; | |
1034 | + } | |
1035 | + case ZipCompression: | |
1036 | + { | |
1037 | + FormatString(buffer,CFormat,"FlateDecode"); | |
1038 | + break; | |
1039 | + } | |
1028 | 1040 | case FaxCompression: |
1029 | 1041 | { |
1030 | 1042 | (void) strcpy(buffer,"/Filter [ /CCITTFaxDecode ]\n"); |
@@ -1034,7 +1046,11 @@ | ||
1034 | 1046 | CCITTParam,image->columns,image->rows); |
1035 | 1047 | break; |
1036 | 1048 | } |
1037 | - default: FormatString(buffer,CFormat,"RunLengthDecode"); break; | |
1049 | + default: | |
1050 | + { | |
1051 | + FormatString(buffer,CFormat,"RunLengthDecode"); | |
1052 | + break; | |
1053 | + } | |
1038 | 1054 | } |
1039 | 1055 | (void) WriteBlobString(image,buffer); |
1040 | 1056 | FormatString(buffer,"/Width %lu\n",image->columns); |
@@ -1127,9 +1143,11 @@ | ||
1127 | 1143 | break; |
1128 | 1144 | } |
1129 | 1145 | } |
1146 | +#if defined(HasZLIB) | |
1130 | 1147 | if (compression == ZipCompression) |
1131 | 1148 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1132 | 1149 | else |
1150 | +#endif /* defined(HasZLIB) */ | |
1133 | 1151 | if (compression == LZWCompression) |
1134 | 1152 | status=LZWEncodeImage(image,length,pixels); |
1135 | 1153 | else |
@@ -1250,9 +1268,11 @@ | ||
1250 | 1268 | break; |
1251 | 1269 | } |
1252 | 1270 | } |
1271 | +#if defined(HasZLIB) | |
1253 | 1272 | if (compression == ZipCompression) |
1254 | 1273 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1255 | 1274 | else |
1275 | +#endif /* defined(HasZLIB) */ | |
1256 | 1276 | if (compression == LZWCompression) |
1257 | 1277 | status=LZWEncodeImage(image,length,pixels); |
1258 | 1278 | else |
@@ -1346,9 +1366,11 @@ | ||
1346 | 1366 | break; |
1347 | 1367 | } |
1348 | 1368 | } |
1369 | +#if defined(HasZLIB) | |
1349 | 1370 | if (compression == ZipCompression) |
1350 | 1371 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1351 | 1372 | else |
1373 | +#endif /* defined(HasZLIB) */ | |
1352 | 1374 | if (compression == LZWCompression) |
1353 | 1375 | status=LZWEncodeImage(image,length,pixels); |
1354 | 1376 | else |
@@ -1440,7 +1462,11 @@ | ||
1440 | 1462 | (void) WriteBlobString(image,"<<\n"); |
1441 | 1463 | switch (compression) |
1442 | 1464 | { |
1443 | - case NoCompression: FormatString(buffer,CFormat,"ASCII85Decode"); break; | |
1465 | + case NoCompression: | |
1466 | + { | |
1467 | + FormatString(buffer,CFormat,"ASCII85Decode"); | |
1468 | + break; | |
1469 | + } | |
1444 | 1470 | case JPEGCompression: |
1445 | 1471 | { |
1446 | 1472 | FormatString(buffer,CFormat,"DCTDecode"); |
@@ -1450,8 +1476,18 @@ | ||
1450 | 1476 | (void) strcpy(buffer,"/Decode [1 0 1 0 1 0 1 0]\n"); |
1451 | 1477 | break; |
1452 | 1478 | } |
1453 | - case LZWCompression: FormatString(buffer,CFormat,"LZWDecode"); break; | |
1454 | - case ZipCompression: FormatString(buffer,CFormat,"FlateDecode"); break; | |
1479 | + case LZWCompression: | |
1480 | + { | |
1481 | + FormatString(buffer,CFormat,"LZWDecode"); | |
1482 | + break; | |
1483 | + } | |
1484 | +#if defined(HasZLIB) | |
1485 | + case ZipCompression: | |
1486 | + { | |
1487 | + FormatString(buffer,CFormat,"FlateDecode"); | |
1488 | + break; | |
1489 | + } | |
1490 | +#endif /* defined(HasZLIB) */ | |
1455 | 1491 | case FaxCompression: |
1456 | 1492 | { |
1457 | 1493 | (void) strcpy(buffer,"/Filter [ /CCITTFaxDecode ]\n"); |
@@ -1546,9 +1582,11 @@ | ||
1546 | 1582 | p++; |
1547 | 1583 | } |
1548 | 1584 | } |
1585 | +#if defined(HasZLIB) | |
1549 | 1586 | if (compression == ZipCompression) |
1550 | 1587 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1551 | 1588 | else |
1589 | +#endif /* defined(HasZLIB) */ | |
1552 | 1590 | if (compression == LZWCompression) |
1553 | 1591 | status=LZWEncodeImage(image,length,pixels); |
1554 | 1592 | else |
@@ -1655,9 +1693,11 @@ | ||
1655 | 1693 | p++; |
1656 | 1694 | } |
1657 | 1695 | } |
1696 | +#if defined(HasZLIB) | |
1658 | 1697 | if (compression == ZipCompression) |
1659 | 1698 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1660 | 1699 | else |
1700 | +#endif /* defined(HasZLIB) */ | |
1661 | 1701 | if (compression == LZWCompression) |
1662 | 1702 | status=LZWEncodeImage(image,length,pixels); |
1663 | 1703 | else |
@@ -1738,9 +1778,11 @@ | ||
1738 | 1778 | for (x=0; x < (long) tile_image->columns; x++) |
1739 | 1779 | *q++=indexes[x]; |
1740 | 1780 | } |
1781 | +#if defined(HasZLIB) | |
1741 | 1782 | if (compression == ZipCompression) |
1742 | 1783 | status=ZLIBEncodeImage(image,length,image_info->quality,pixels); |
1743 | 1784 | else |
1785 | +#endif /* defined(HasZLIB) */ | |
1744 | 1786 | if (compression == LZWCompression) |
1745 | 1787 | status=LZWEncodeImage(image,length,pixels); |
1746 | 1788 | else |
@@ -1787,21 +1829,16 @@ | ||
1787 | 1829 | FormatString(buffer,"%lu\n",(unsigned long) offset); |
1788 | 1830 | (void) WriteBlobString(image,buffer); |
1789 | 1831 | (void) WriteBlobString(image,"endobj\n"); |
1790 | - if ((image->storage_class == DirectClass) || (image->colors > 256) || | |
1791 | - (compression == FaxCompression)) | |
1832 | + /* | |
1833 | + Write Colormap object. | |
1834 | + */ | |
1835 | + xref[object++]=TellBlob(image); | |
1836 | + FormatString(buffer,"%lu 0 obj\n",object); | |
1837 | + (void) WriteBlobString(image,buffer); | |
1838 | + (void) WriteBlobString(image,"<<\n"); | |
1839 | + if ((image->storage_class != DirectClass) && (image->colors <= 256) && | |
1840 | + (compression != FaxCompression)) | |
1792 | 1841 | { |
1793 | - xref[object++]=0; | |
1794 | - xref[object++]=0; | |
1795 | - } | |
1796 | - else | |
1797 | - { | |
1798 | - /* | |
1799 | - Write Colormap object. | |
1800 | - */ | |
1801 | - xref[object++]=TellBlob(image); | |
1802 | - FormatString(buffer,"%lu 0 obj\n",object); | |
1803 | - (void) WriteBlobString(image,buffer); | |
1804 | - (void) WriteBlobString(image,"<<\n"); | |
1805 | 1842 | if (compression == NoCompression) |
1806 | 1843 | (void) WriteBlobString(image,"/Filter [ /ASCII85Decode ]\n"); |
1807 | 1844 | FormatString(buffer,"/Length %lu 0 R\n",object+1); |
@@ -1812,36 +1849,36 @@ | ||
1812 | 1849 | if (compression == NoCompression) |
1813 | 1850 | Ascii85Initialize(image); |
1814 | 1851 | for (i=0; i < (long) image->colors; i++) |
1815 | - { | |
1816 | - if (compression == NoCompression) | |
1817 | - { | |
1818 | - Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].red)); | |
1819 | - Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].green)); | |
1820 | - Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].blue)); | |
1821 | - continue; | |
1822 | - } | |
1823 | - (void) WriteBlobByte(image, | |
1824 | - ScaleQuantumToChar(image->colormap[i].red)); | |
1825 | - (void) WriteBlobByte(image, | |
1826 | - ScaleQuantumToChar(image->colormap[i].green)); | |
1827 | - (void) WriteBlobByte(image, | |
1828 | - ScaleQuantumToChar(image->colormap[i].blue)); | |
1829 | - } | |
1852 | + { | |
1853 | + if (compression == NoCompression) | |
1854 | + { | |
1855 | + Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].red)); | |
1856 | + Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].green)); | |
1857 | + Ascii85Encode(image,ScaleQuantumToChar(image->colormap[i].blue)); | |
1858 | + continue; | |
1859 | + } | |
1860 | + (void) WriteBlobByte(image, | |
1861 | + ScaleQuantumToChar(image->colormap[i].red)); | |
1862 | + (void) WriteBlobByte(image, | |
1863 | + ScaleQuantumToChar(image->colormap[i].green)); | |
1864 | + (void) WriteBlobByte(image, | |
1865 | + ScaleQuantumToChar(image->colormap[i].blue)); | |
1866 | + } | |
1830 | 1867 | if (compression == NoCompression) |
1831 | 1868 | Ascii85Flush(image); |
1832 | - offset=TellBlob(image)-offset; | |
1833 | - (void) WriteBlobString(image,"\nendstream\n"); | |
1834 | - (void) WriteBlobString(image,"endobj\n"); | |
1835 | - /* | |
1836 | - Write Length object. | |
1837 | - */ | |
1838 | - xref[object++]=TellBlob(image); | |
1839 | - FormatString(buffer,"%lu 0 obj\n",object); | |
1840 | - (void) WriteBlobString(image,buffer); | |
1841 | - FormatString(buffer,"%lu\n",(unsigned long) offset); | |
1842 | - (void) WriteBlobString(image,buffer); | |
1843 | - (void) WriteBlobString(image,"endobj\n"); | |
1844 | 1869 | } |
1870 | + offset=TellBlob(image)-offset; | |
1871 | + (void) WriteBlobString(image,"\nendstream\n"); | |
1872 | + (void) WriteBlobString(image,"endobj\n"); | |
1873 | + /* | |
1874 | + Write Length object. | |
1875 | + */ | |
1876 | + xref[object++]=TellBlob(image); | |
1877 | + FormatString(buffer,"%lu 0 obj\n",object); | |
1878 | + (void) WriteBlobString(image,buffer); | |
1879 | + FormatString(buffer,"%lu\n",(unsigned long) offset); | |
1880 | + (void) WriteBlobString(image,buffer); | |
1881 | + (void) WriteBlobString(image,"endobj\n"); | |
1845 | 1882 | if (image->next == (Image *) NULL) |
1846 | 1883 | break; |
1847 | 1884 | image=SyncNextImageInList(image); |
@@ -56,6 +56,8 @@ | ||
56 | 56 | 2005-04-01 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> |
57 | 57 | |
58 | 58 | <UL> |
59 | + <LI> coders/pdf.c (WritePDFImage): Integrate fixes for Ghoscript 8.50 | |
60 | + warning from the 1.1 branch.<BR> | |
59 | 61 | <LI> magick/tempfile.c (DestroyTemporaryFiles): Back port memory leak |
60 | 62 | fix from version 1.1. |
61 | 63 |