summaryrefslogtreecommitdiff
path: root/pcl
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2011-12-12 21:58:38 -0700
committerHenry Stiles <henry.stiles@artifex.com>2011-12-13 11:19:59 -0700
commite04069bf8549eba33e7ba71398769609b72d2026 (patch)
tree9cb9a6b72165007f5fae6d7a2b69f81b9fdd5649 /pcl
parentabf148da6950f4f39d57603fb316584ea0975fa7 (diff)
Reorganize the initialization of the pen width and residual palette
color entries. In particular, the pen width initialization was incorrect, applying default pen widths to pens that shouldn't be reset. This changes result in progressions for the following files: tests_private/pcl/pcl5ccet/31-09.BIN tests_private/pcl/pcl5ccet/34-03.BIN tests_private/xl/pcl6cet3.0/C705.bin
Diffstat (limited to 'pcl')
-rw-r--r--pcl/pcindxed.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/pcl/pcindxed.c b/pcl/pcindxed.c
index 1860d34ab..ee0b57e0d 100644
--- a/pcl/pcindxed.c
+++ b/pcl/pcindxed.c
@@ -108,6 +108,7 @@ alloc_indexed_cspace(
int code = 0;
byte * bp = 0;
uint palette_size = 3 * num_entries;
+ int i;
#ifdef DEBUG
if_debug1('c', "[c]alloc_indexed_cspace entries:%d\n", num_entries);
@@ -140,7 +141,9 @@ alloc_indexed_cspace(
}
pindexed->palette.data = bp;
pindexed->palette.size = palette_size;
-
+ for (i = 0; i < num_entries; i++)
+ pindexed->pen_widths[i] = dflt_pen_width;
+
code = gs_cspace_build_Indexed( &(pindexed->pcspace),
pbase->pcspace,
num_entries,
@@ -166,7 +169,8 @@ resize_indexed_cspace(
byte *pdata;
gs_memory_t *pmem = pindexed->rc.memory;
uint new_size = num_entries * 3;
-
+ int i;
+ uint num_old_entries;
#ifdef DEBUG
if_debug2('c', "[c]resizing_indexed_cspace new:%d old:%d\n",
num_entries, pindexed->num_entries);
@@ -176,6 +180,7 @@ resize_indexed_cspace(
"resize pcl indexed color space");
if (pdata == NULL)
return gs_error_VMerror;
+ num_old_entries = pindexed->num_entries;
pindexed->num_entries = num_entries;
pindexed->palette.data = pdata;
/* NB duplicate data storage */
@@ -183,6 +188,10 @@ resize_indexed_cspace(
pindexed->pcspace->params.indexed.lookup.table.data = (const byte *)pdata;
pindexed->palette.data = pdata;
pindexed->pcspace->params.indexed.hival = num_entries - 1;
+ /* if the palette has grown we have to fill in the default line
+ width values */
+ for (i = num_old_entries; i < num_entries; i++)
+ pindexed->pen_widths[i] = dflt_pen_width;
return 0;
}
@@ -536,18 +545,11 @@ set_default_entries(
cnt
);
- /* all other entries are black (always comp. value 0). For
- simplicity we reset all of the the remaining pallete data. */
- if (num > cnt) {
- int bytes_initialized = 3 * (start + cnt);
- int bytes_left = pindexed->palette.size - bytes_initialized;
- memset(pindexed->palette.data + bytes_initialized, 0, bytes_left);
+ /* set the remaining entries to black */
+ for (i = (start + cnt); i < (start + num); i++) {
+ byte *bp = pindexed->palette.data + i * 3;
+ bp[0] = bp[1] = bp[2] = 0;
}
-
- /* set the default widths */
- for (i = start; i < num; i++)
- pindexed->pen_widths[i] = dflt_pen_width;
-
return 0;
}