summaryrefslogtreecommitdiff
path: root/gs/src/gdevpdfi.c
diff options
context:
space:
mode:
authorL Peter Deutsch <lpd@ghostscript.com>2001-07-12 05:47:07 +0000
committerL Peter Deutsch <lpd@ghostscript.com>2001-07-12 05:47:07 +0000
commit10f8b87fb2da106e7121b3e4d16519e7ac8f7621 (patch)
treea3cfab6cd26609d7592a4a61a0c66b9bf132c5df /gs/src/gdevpdfi.c
parent1930ffa7696d65fd2dc72d030b44d4db4c0642fb (diff)
downloadghostpdl-10f8b87fb2da106e7121b3e4d16519e7ac8f7621.tar.gz
Fix: pdfwrite didn't write transfer functions in the output for images, and
allowed lossy compressions on images even in the presence of peculiar transfer functions (such as functions simulating indexed color spaces). This fix writes transfer functions for images, prevents lossy compression if the transfer function is not the identity, and undoes the hack that was implemented earlier to work around this problem. Fixes SourceForge bug #420257. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@1595 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/src/gdevpdfi.c')
-rw-r--r--gs/src/gdevpdfi.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gs/src/gdevpdfi.c b/gs/src/gdevpdfi.c
index 5997a1a58..a0b199fef 100644
--- a/gs/src/gdevpdfi.c
+++ b/gs/src/gdevpdfi.c
@@ -297,10 +297,22 @@ pdf_begin_typed_image(gx_device_pdf *pdev, const gs_imager_state * pis,
}
if ((code = pdf_begin_write_image(pdev, &pie->writer, gs_no_id, width,
height, NULL, in_line)) < 0 ||
- /****** pctm IS WRONG ******/
- (code = psdf_setup_image_filters((gx_device_psdf *) pdev,
- &pie->writer.binary, &image.pixel,
- pmat, pis)) < 0 ||
+ /*
+ * Some regrettable PostScript code (such as LanguageLevel 1 output
+ * from Microsoft's PSCRIPT.DLL driver) misuses the transfer
+ * function to accomplish the equivalent of indexed color.
+ * Downsampling (well, only averaging) or JPEG compression are not
+ * compatible with this. Play it safe by using only lossless
+ * filters if the transfer function(s) is/are other than the
+ * identity.
+ */
+ (code = (pdev->transfer_not_identity ?
+ psdf_setup_lossless_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary,
+ &image.pixel) :
+ psdf_setup_image_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary, &image.pixel,
+ pmat, pis))) < 0 ||
(code = pdf_begin_image_data(pdev, &pie->writer,
(const gs_pixel_image_t *)&image,
&cs_value)) < 0