summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2020-02-25 19:39:50 +0000
committerChris Liddell <chris.liddell@artifex.com>2020-02-26 08:18:49 +0000
commit86f81e9b799b66207c699768616a6e3ba3c311c3 (patch)
tree492c112e6dc0c59b5e4114f4c60e9df41a30e3d7
parent635303ca7d8a36b3dabc9afbd9132f4b9a36dce5 (diff)
downloadghostpdl-86f81e9b799b66207c699768616a6e3ba3c311c3.tar.gz
Fix gx_default_copy_alpha_hl_color for 16 bit operation.
The code to write the composite data back to buffers to be sent to copy_alpha was getting the first byte of each 16 bit pair wrong in the 16bit data case. Also, when we 'restart' after skipping a zero byte in the 16bit case we need to skip 2 bytes per pixel, not one. This can be seen when running: gs -r72 -o out%d.psd -sDEVICE=psdcmyk16 -dMaxBitmap=2000M ../tests_private/comparefiles/js.pdf
-rw-r--r--base/gdevdbit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/base/gdevdbit.c b/base/gdevdbit.c
index 8b5fa2f97..faeac5f65 100644
--- a/base/gdevdbit.c
+++ b/base/gdevdbit.c
@@ -194,14 +194,12 @@ gx_default_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
byte *src_planes[GS_CLIENT_COLOR_MAX_COMPONENTS];
gs_int_rect gb_rect;
int byte_depth;
- gx_color_index mask;
int shift, word_width;
gx_color_value *composite;
byte *gb_buff;
int x_curr, w_curr, gb_buff_start;
byte_depth = bpp / ncomps;
- mask = ((gx_color_index)1 << byte_depth) - 1;
shift = 16 - byte_depth;
word_width = byte_depth >> 3;
@@ -292,7 +290,7 @@ gx_default_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
return code;
}
/* reset ourselves */
- gb_buff_start = gb_buff_start + w_curr;
+ gb_buff_start = gb_buff_start + w_curr * word_width;
w_curr = 0;
x_curr = rx + 1;
} else {
@@ -330,9 +328,9 @@ gx_default_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
byte *ptr = ((src_planes[k]) + (sx - data_x) * word_width);
switch (word_width) {
case 2:
- *ptr++ = composite[k] & mask;
+ *ptr++ = composite[k] >> 8;
case 1:
- *ptr++ = (composite[k] >> shift) & mask;
+ *ptr++ = composite[k] >> shift;
}
}
} /* else on alpha != 0 */