summaryrefslogtreecommitdiff
path: root/gs
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-05-25 17:55:31 +0100
committerRobin Watts <robin.watts@artifex.com>2012-05-25 17:55:31 +0100
commitfad17657f6f583dbdef5a634d0f11dd79e446ffe (patch)
treea41291f4efa48486a1167f871aa690d89ccce327 /gs
parent1c9e30044d1d698701091c9913a81e4b3688a134 (diff)
Bug 693070: psdrgb wasn't giving corrupted output.HEADmaster
There were actually 2 bugs in here. The first one was spotted and fixed by James Cloos - many thanks; the arguments to memcpy were reversed. The second one was to do with the fact that postscript operation now thinks it has 14 colors. When we encode/decode, we were packing the colors into a word in such a way that we were losing the interesting ones off the top. Reverse the order of packing, and all is well. This still leaves an "interesting" fact about this device; we loop: for (chan_idx = 0; chan_idx < num_comp; chan_idx++) ... for (j = 0; j < xc->height; j++) ... get_bits_rectangle So, in the case where we have n components, and more than 1 band we'll be rendering the entire file n times - despite the fact that we request all the colors each time!
Diffstat (limited to 'gs')
-rw-r--r--gs/base/gdevpsd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gs/base/gdevpsd.c b/gs/base/gdevpsd.c
index 8251bcd73..5a640e7ca 100644
--- a/gs/base/gdevpsd.c
+++ b/gs/base/gdevpsd.c
@@ -630,7 +630,7 @@ psd_encode_color(gx_device *dev, const gx_color_value colors[])
COLROUND_SETUP(bpc);
for (; i<ncomp; i++) {
color <<= bpc;
- color |= COLROUND_ROUND(colors[i]);
+ color |= COLROUND_ROUND(colors[ncomp-1-i]);
}
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -649,7 +649,7 @@ psd_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out)
COLDUP_SETUP(bpc);
for (; i<ncomp; i++) {
- out[ncomp - i - 1] = COLDUP_DUP(color & mask);
+ out[i] = COLDUP_DUP(color & mask);
color >>= bpc;
}
return 0;
@@ -1311,7 +1311,7 @@ psd_write_image_data(psd_write_ctx *xc, gx_device_printer *pdev)
// if (link == NULL) {
if (base_bytes_pp == 3) {
/* RGB */
- memcpy(unpacked, sep_line, xc->width);
+ memcpy(sep_line, unpacked, xc->width);
} else {
for (i = 0; i < xc->width; ++i) {
/* CMYK + spots*/
@@ -1359,4 +1359,4 @@ psd_print_page(gx_device_printer *pdev, FILE *file)
free_separation_names(pdev->memory, &(psd_dev->devn_params.separations));
psd_dev->devn_params.num_separation_order_names = 0;
return 0;
-} \ No newline at end of file
+}