[gs-cvs] rev 8862 - trunk/gs/src - wrong log message.
Leonardo
leonardo at artifex.com
Mon Jul 21 23:48:32 PDT 2008
The revision 8862 was committed with a wrong log message.
Here is the right one :
[Log message beg]
Fix (graphics) : Write tile id into a pattern clist.
DETAILS :
Bug 689818 "Regression: Test file imagemask-with-pattern.ps fails with
banding and pbmraw ".
The old code doesn't write a tile id when writing the tile to clist,
because the clist interpreter doesn't use tile id.
This causes a failure after we implemented clist-based patterns.
While playing back a pattern clist to a page clist writer device,
the clist writer does need a tile id
for choosing an entry of an internal hash table.
Actually the failure happens due to a strange check
"tile->id != gx_no_bitmap_id" in
clist_strip_tile_rectangle in gxclrect.c ln 479.
It is not clear what it was intended for.
When a tile id is zero, the check skips writing tile size to clist,
so that a zerodevide happens during the clist playback.
We decided to provide meanful ids
because the clist writer needs them anyway.
Fixing the check to be a subject of a separate patch
(if a fix is really necessary).
This patch simply writes tile id when the clist
is for a pattern. A new macro IS_CLIST_FOR_PATTERN(cdev)
Defines the condition for that.
Some internal functions change prototypes
with adding a new boolean argument for_pattern to know
whether a clist is for a pattern.
EXPECTED DIFFERENCES :
None.
[Log message end]
I fixed the repository.
Leo.
----- Original Message -----
From: <leonardo at ghostscript.com>
To: <gs-cvs at ghostscript.com>
Sent: Tuesday, July 22, 2008 10:24 AM
Subject: [gs-cvs] rev 8862 - trunk/gs/src
> Author: leonardo
> Date: 2008-07-21 23:24:14 -0700 (Mon, 21 Jul 2008)
> New Revision: 8862
>
> Modified:
> trunk/gs/src/gdevprn.c
> trunk/gs/src/gxclbits.c
> trunk/gs/src/gxclist.h
> trunk/gs/src/gxclrast.c
> Log:
> Fix (transparency) : A mask buffer could left unreleased due to banding.
>
> DETAILS :
>
> Bug 689944 "Reference to free object".
>
> See comment in code.
>
> EXPECTED DIFFERENCES :
>
> None.
>
>
>
> Modified: trunk/gs/src/gdevprn.c
> ===================================================================
> --- trunk/gs/src/gdevprn.c 2008-07-22 00:32:19 UTC (rev 8861)
> +++ trunk/gs/src/gdevprn.c 2008-07-22 06:24:14 UTC (rev 8862)
> @@ -57,6 +57,8 @@
> int old_width, int old_height,
> bool old_page_uses_transparency);
>
> +extern dev_proc_open_device(pattern_clist_open_device);
> +
> /* ------ Open/close ------ */
>
> /* Open a generic printer device. */
>
> Modified: trunk/gs/src/gxclbits.c
> ===================================================================
> --- trunk/gs/src/gxclbits.c 2008-07-22 00:32:19 UTC (rev 8861)
> +++ trunk/gs/src/gxclbits.c 2008-07-22 06:24:14 UTC (rev 8862)
> @@ -237,9 +237,10 @@
>
> /* Add a command to set the tile size and depth. */
> static uint
> -cmd_size_tile_params(const gx_strip_bitmap * tile)
> +cmd_size_tile_params(const gx_strip_bitmap * tile, bool for_pattern)
> {
> - return 2 + cmd_size_w(tile->rep_width) + cmd_size_w(tile->rep_height)
> +
> + return 2 + (for_pattern ? cmd_size_w(tile->id) : 0) +
> + cmd_size_w(tile->rep_width) + cmd_size_w(tile->rep_height) +
> (tile->rep_width == tile->size.x ? 0 :
> cmd_size_w(tile->size.x / tile->rep_width)) +
> (tile->rep_height == tile->size.y ? 0 :
> @@ -248,12 +249,14 @@
> }
> static void
> cmd_store_tile_params(byte * dp, const gx_strip_bitmap * tile, int depth,
> - uint csize)
> + uint csize, bool for_pattern)
> {
> byte *p = dp + 2;
> byte bd = cmd_depth_to_code(depth);
>
> *dp = cmd_count_op(cmd_opv_set_tile_size, csize);
> + if (for_pattern)
> + p = cmd_put_w(tile->id, p);
> p = cmd_put_w(tile->rep_width, p);
> p = cmd_put_w(tile->rep_height, p);
> if (tile->rep_width != tile->size.x) {
> @@ -550,6 +553,8 @@
> #undef max_tile_bytes
> }
>
> +extern dev_proc_open_device(pattern_clist_open_device);
> +
> /* Change tile for clist_tile_rectangle. */
> int
> clist_change_tile(gx_device_clist_writer * cldev, gx_clist_state * pcls,
> @@ -569,6 +574,7 @@
> int band_index = pcls - cldev->states;
> byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
> byte bmask = 1 << (band_index & 7);
> + bool for_pattern = IS_CLIST_FOR_PATTERN(cldev);
>
> if (*bptr & bmask) { /* Already known. Just set the index. */
> if (pcls->tile_index == loc.index)
> @@ -578,8 +584,8 @@
> } else {
> uint extra = 0;
>
> - if tile_params_differ
> - (cldev, tiles, depth) { /*
> + if (tile_params_differ(cldev, tiles, depth) ||
> + for_pattern) { /*
> * We have a cached tile whose parameters differ from
> * the current ones. Because of the way tile IDs are
> * managed, this is currently only possible when mixing
> @@ -603,7 +609,7 @@
> cldev->tile_known_max = -1;
> }
> if (!(pcls->known & tile_params_known)) { /* We're going to have to
> write the tile parameters. */
> - extra = cmd_size_tile_params(&cldev->tile_params);
> + extra = cmd_size_tile_params(&cldev->tile_params, for_pattern);
> } { /*
> * This band doesn't know this tile yet, so output the
> * bits. Note that the offset we write is the one used by
> @@ -632,7 +638,7 @@
> return code;
> if (extra) { /* Write the tile parameters before writing the bits. */
> cmd_store_tile_params(dp, &cldev->tile_params, depth,
> - extra);
> + extra, for_pattern);
> dp += extra;
> /* This band now knows the parameters. */
> pcls->known |= tile_params_known;
>
> Modified: trunk/gs/src/gxclist.h
> ===================================================================
> --- trunk/gs/src/gxclist.h 2008-07-22 00:32:19 UTC (rev 8861)
> +++ trunk/gs/src/gxclist.h 2008-07-22 06:24:14 UTC (rev 8862)
> @@ -184,6 +184,12 @@
> gx_band_page_info_t page_info; /* page information */\
> int nbands /* # of bands */
>
> +/*
> + * Chech whether a clist is used for storing a pattern command stream.
> + * Useful for both reader and writer.
> + */
> +#define IS_CLIST_FOR_PATTERN(cdev) (cdev->procs.open_device ==
> pattern_clist_open_device)
> +
> typedef struct gx_device_clist_common_s {
> gx_device_clist_common_members;
> } gx_device_clist_common;
>
> Modified: trunk/gs/src/gxclrast.c
> ===================================================================
> --- trunk/gs/src/gxclrast.c 2008-07-22 00:32:19 UTC (rev 8861)
> +++ trunk/gs/src/gxclrast.c 2008-07-22 06:24:14 UTC (rev 8862)
> @@ -226,7 +226,7 @@
> * Render one band to a specified target device. Note that if
> * action == setup, target may be 0.
> */
> -static int read_set_tile_size(command_buf_t *pcb, tile_slot *bits);
> +static int read_set_tile_size(command_buf_t *pcb, tile_slot *bits, bool
> for_pattern);
> static int read_set_bits(command_buf_t *pcb, tile_slot *bits,
> int compress, gx_clist_state *pcls,
> gx_strip_bitmap *tile, tile_slot **pslot,
> @@ -640,7 +640,8 @@
> continue;
> case cmd_opv_set_tile_size:
> cbuf.ptr = cbp;
> - code = read_set_tile_size(&cbuf, &tile_bits);
> + code = read_set_tile_size(&cbuf, &tile_bits,
> + IS_CLIST_FOR_PATTERN(cdev));
> cbp = cbuf.ptr;
> if (code < 0)
> goto out;
> @@ -2088,13 +2089,15 @@
> */
>
> static int
> -read_set_tile_size(command_buf_t *pcb, tile_slot *bits)
> +read_set_tile_size(command_buf_t *pcb, tile_slot *bits, bool for_pattern)
> {
> const byte *cbp = pcb->ptr;
> uint rep_width, rep_height;
> byte bd = *cbp++;
>
> bits->cb_depth = cmd_code_to_depth(bd);
> + if (for_pattern)
> + cmd_getw(bits->id, cbp);
> cmd_getw(rep_width, cbp);
> cmd_getw(rep_height, cbp);
> if (bd & 0x20) {
>
> _______________________________________________
> gs-cvs mailing list
> gs-cvs at ghostscript.com
> http://www.ghostscript.com/mailman/listinfo/gs-cvs
>
More information about the gs-cvs
mailing list