diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2017-03-12 17:07:18 -0700 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2017-03-14 18:55:34 +0000 |
commit | 6ffbbb5a389df10d7b7a0a630a910363f75b73d6 (patch) | |
tree | c50aa2f79235e0f6b43e22cc787996352fb0c34d | |
parent | a629fb9e9f03d8d5aefd32d3c46f6045dba41ccb (diff) | |
download | ghostpdl-6ffbbb5a389df10d7b7a0a630a910363f75b73d6.tar.gz |
Fix Bug 697661 -- SEGV with tiffsep1 device and threshold array halftones
Threshold arrays create a different type of gx_ht_order than screen type
halftones so the bit_data is short X,Y coordinates instead of offset,mask
(gx_ht_bit) elements that the tiffsep1 "threshold_from_order" code was
expecting. Using the bit_index proc of the order works for all gx_ht_order
types.
TODO: determine if it is possible to use the gx_ht_construct_threshold
function. This function is used in the FAST_HT_CODE used for some
images to halftone devices that need halftoning.
-rw-r--r-- | devices/gdevtsep.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/devices/gdevtsep.c b/devices/gdevtsep.c index 8823c75d9..5edc9fd55 100644 --- a/devices/gdevtsep.c +++ b/devices/gdevtsep.c @@ -2104,7 +2104,6 @@ threshold_from_order( gx_ht_order *d_order, int *Width, int *Height, gs_memory_t unsigned char *thresh; gx_ht_bit *bits = (gx_ht_bit *)d_order->bit_data; int num_repeat, shift; - int row_kk, col_kk, kk; /* We can have simple or complete orders. Simple ones tile the threshold with shifts. To handle those we simply loop over the number of @@ -2144,32 +2143,25 @@ if ( gs_debug_c('h') ) { while( l < d_order->num_levels ) { if( d_order->levels[l] > d_order->levels[prev_l] ) { int t_level = (256*l)/d_order->num_levels; - int row, col; + #ifdef DEBUG if ( gs_debug_c('h') ) dmprintf2(memory, " level[%3d]=%3d\n", l, d_order->levels[l]); #endif for( j=d_order->levels[prev_l]; j<d_order->levels[l]; j++) { -#ifdef DEBUG - if ( gs_debug_c('h') ) - dmprintf2(memory, " bits.offset=%3d, bits.mask=%8x ", - bits[j].offset, bits[j].mask); -#endif - row = bits[j].offset / d_order->raster; - for( col=0; col < (8*sizeof(ht_mask_t)); col++ ) { - if( bits[j].mask & bit_order[col] ) - break; - } - col += 8 * ( bits[j].offset - (row * d_order->raster) ); + gs_int_point col_row = { 0, 0 }; + int col_kk, row_kk, kk; + + d_order->procs->bit_index(d_order, j, &col_row); #ifdef DEBUG if ( gs_debug_c('h') ) dmprintf3(memory, "row=%2d, col=%2d, t_level=%3d\n", - row, col, t_level); + col_row.y, col_row.x, t_level); #endif - if( col < (int)d_order->width ) { + if( col_row.x < (int)d_order->width ) { for (kk = 0; kk < num_repeat; kk++) { - row_kk = row + kk * d_order->height; - col_kk = col + kk * shift; + row_kk = col_row.y + kk * d_order->height; + col_kk = col_row.x + kk * shift; col_kk = col_kk % d_order->width; *(thresh + col_kk + (row_kk * d_order->width)) = t_level; } |