diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-03-04 16:54:00 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-03-08 10:42:21 +0000 |
commit | 3ba81aa81d256f5a31e89db2dd2aedab46794f6d (patch) | |
tree | f2f052f99422778d4a9478a2acb2fa7796142039 /base/gxclrect.c | |
parent | a9c7640b90bc583e04be7b1eebccd5c07e79c063 (diff) | |
download | ghostpdl-3ba81aa81d256f5a31e89db2dd2aedab46794f6d.tar.gz |
Improve clist debugging output.
Firstly, at various points when writing the clist, we allocate a
block (inside cmd_put_bits) under the name of 'end_run'. This is
dutifully printed by the debugging code. We then rewrite that
block so it's not an end_run at all, but rather something like
a set_bits operation (or even 2 operations).
The debugging printing is therefore confusing. It would be fairly
tricky to neatly (and efficiently) get the printing correct, so
we add some new prints to the debugging code, so that rewrites
of these 'fake' end_runs are documented.
Secondly, we update clist_change_tile to print out the params it
reads back (enabling us to easily compare them to the ones printed
during the writing phase).
Finally, we update a deficiency with the debugging with cmd_read_data.
The reading phase calls cmd_read_data to copy data out from the
buffered stream into blocks of data (for example, for set_bits).
This data is copied first from the buffer that the clist reader holds,
but if more data is required than the buffer actually has it,
bytes can be pulled direct from the stream itself.
Unfortunately, in this latter case, this sidesteps the debug code's
attempts to keep a correct record of the offset it has within the
file, meaning that it's hard to match reading and writing debug
prints up. We fix this here, by calling a function, with the pithy
name 'new adjust_offset_map_for_skipped_data'.
Diffstat (limited to 'base/gxclrect.c')
-rw-r--r-- | base/gxclrect.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/base/gxclrect.c b/base/gxclrect.c index d3ee98495..ce817ac81 100644 --- a/base/gxclrect.c +++ b/base/gxclrect.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -890,9 +890,21 @@ copy:{ } op += compress; if (dx) { + if_debug0m('L', dev->memory, + "[L] fake end_run: really set_misc_data_x[2]\n"); *dp++ = cmd_count_op(cmd_opv_set_misc, 2, dev->memory); *dp++ = cmd_set_misc_data_x + dx; } +#ifdef DEBUG + if (gs_debug_c('L')) { + const char *const *sub = cmd_sub_op_names[op >> 4]; + + if (sub) + dmlprintf1(dev->memory, "[L] fake end_run: really %s\n", sub[op & 0xf]); + else + dmlprintf2(dev->memory, "[L] fake end_run: really %s %d\n", cmd_op_names[op >> 4], op & 0xf); + } +#endif *dp++ = cmd_count_op(op, csize, dev->memory); /* Store the plane_height */ cmd_putw(0, &dp); @@ -1012,9 +1024,21 @@ clist_copy_planes(gx_device * dev, * cmd_put_bits fill the buffer up. */ dp2 = dp; if (dx) { + if_debug0m('L', cdev->memory, + "[L] fake end_run: really set_misc_data_x[2]\n"); *dp2++ = cmd_count_op(cmd_opv_set_misc, 2, cdev->memory); *dp2++ = cmd_set_misc_data_x + dx; } +#ifdef DEBUG + if (gs_debug_c('L')) { + const char *const *sub = cmd_sub_op_names[(op+code) >> 4]; + + if (sub) + dmlprintf1(cdev->memory, "[L] fake end_run: really %s\n", sub[(op+code) & 0xf]); + else + dmlprintf2(cdev->memory, "[L] fake end_run: really %s %d\n", cmd_op_names[(op+code) >> 4], (op+code) & 0xf); + } +#endif *dp2++ = cmd_count_op(op + code, csize, cdev->memory); cmd_putw(plane_height, &dp2); cmd_put2w(rx, re.y, &dp2); @@ -1144,9 +1168,21 @@ copy:{ } op += compress; if (dx) { + if_debug0m('L', dev->memory, + "[L] fake end_run: really set_misc_data_x[2]\n"); *dp++ = cmd_count_op(cmd_opv_set_misc, 2, dev->memory); *dp++ = cmd_set_misc_data_x + dx; } +#ifdef DEBUG + if (gs_debug_c('L')) { + const char *const *sub = cmd_sub_op_names[op >> 4]; + + if (sub) + dmlprintf1(dev->memory, "[L] fake end_run: really %s\n", sub[op & 0xf]); + else + dmlprintf2(dev->memory, "[L] fake end_run: really %s %d\n", cmd_op_names[op >> 4], op & 0xf); + } +#endif *dp++ = cmd_count_op(op, csize, dev->memory); cmd_put2w(rx, re.y, &dp); cmd_put2w(w1, re.height, &dp); @@ -1273,9 +1309,21 @@ copy:{ } op += compress; if (dx) { + if_debug0m('L', dev->memory, + "[L] fake end_run: really set_misc_data_x[2]\n"); *dp++ = cmd_count_op(cmd_opv_set_misc, 2, dev->memory); *dp++ = cmd_set_misc_data_x + dx; } +#ifdef DEBUG + if (gs_debug_c('L')) { + const char *const *sub = cmd_sub_op_names[op >> 4]; + + if (sub) + dmlprintf1(dev->memory, "[L] fake end_run: really %s\n", sub[op & 0xf]); + else + dmlprintf2(dev->memory, "[L] fake end_run: really %s %d\n", cmd_op_names[op >> 4], op & 0xf); + } +#endif *dp++ = cmd_count_op(op, csize, dev->memory); *dp++ = depth; cmd_put2w(rx, re.y, &dp); @@ -1403,9 +1451,21 @@ copy:{ } op += compress; if (dx) { + if_debug0m('L', dev->memory, + "[L] fake end_run: really set_misc_data_x[2]\n"); *dp++ = cmd_count_op(cmd_opv_set_misc, 2, dev->memory); *dp++ = cmd_set_misc_data_x + dx; } +#ifdef DEBUG + if (gs_debug_c('L')) { + const char *const *sub = cmd_sub_op_names[op >> 4]; + + if (sub) + dmlprintf1(dev->memory, "[L] fake end_run: really %s\n", sub[op & 0xf]); + else + dmlprintf2(dev->memory, "[L] fake end_run: really %s %d\n", cmd_op_names[op >> 4], op & 0xf); + } +#endif *dp++ = cmd_count_op(op, csize, dev->memory); *dp++ = depth; cmd_put2w(rx, re.y, &dp); |