[gs-cvs] rev 7859 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Mon Apr 16 23:55:37 PDT 2007
Author: leonardo
Date: 2007-04-16 23:55:36 -0700 (Mon, 16 Apr 2007)
New Revision: 7859
Modified:
trunk/gs/src/gxpcmap.c
Log:
Implementing high level patterns, step 7.
DETAILS :
This is a preparation for fixing the bug 688396, step 7.
This patch fixes the Bug 689176
"Infinite loop in gxpcmap.c ln 680.",
which was introduced with revision 7853
In gx_pattern_cache_add_entry mbits was reset
before revision 7853 when "the pattern completely fills its box",
and it was not after the revision 7853.
Thus the revision 7853 appears not algorithmically equivalent
rathen than expected.
This change restores the correct behavior,
and improves gx_pattern_cache_free_entry
for an easier monitoring of a pattern cell memory size
with a C debugger.
This code needs further improvements :
1. Large uncolored patterns are not implemented.
2. Get rid of non_gc_memory in the pattern clist writer.
3. clist_init is called twice when creating a clist-based pattern.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxpcmap.c
===================================================================
--- trunk/gs/src/gxpcmap.c 2007-04-17 00:25:38 UTC (rev 7858)
+++ trunk/gs/src/gxpcmap.c 2007-04-17 06:55:36 UTC (rev 7859)
@@ -576,6 +576,7 @@
if ((ctile->id != gx_no_bitmap_id) && !ctile->is_dummy) {
gs_memory_t *mem = pcache->memory;
gx_device_memory mdev;
+ ulong used = 0;
/*
* We must initialize the memory device properly, even though
@@ -586,7 +587,7 @@
mdev.width = ctile->tmask.size.x;
mdev.height = ctile->tmask.size.y;
/*mdev.color_info.depth = 1;*/
- pcache->bits_used -= gdev_mem_bitmap_size(&mdev);
+ used = gdev_mem_bitmap_size(&mdev);
gs_free_object(mem, ctile->tmask.data,
"free_pattern_cache_entry(mask data)");
ctile->tmask.data = 0; /* for GC */
@@ -595,7 +596,7 @@
mdev.width = ctile->tbits.size.x;
mdev.height = ctile->tbits.size.y;
mdev.color_info.depth = ctile->depth;
- pcache->bits_used -= gdev_mem_bitmap_size(&mdev);
+ used += gdev_mem_bitmap_size(&mdev);
gs_free_object(mem, ctile->tbits.data,
"free_pattern_cache_entry(bits data)");
ctile->tbits.data = 0; /* for GC */
@@ -604,8 +605,9 @@
dev_proc(&ctile->cdev->common, close_device)((gx_device *)&ctile->cdev->common);
ctile->cdev = NULL;
}
+ pcache->tiles_used--;
+ pcache->bits_used -= used;
ctile->id = gx_no_bitmap_id;
- pcache->tiles_used--;
}
}
@@ -627,15 +629,17 @@
gx_color_tile *ctile;
int code = ensure_pattern_cache(pis);
extern dev_proc_open_device(pattern_clist_open_device);
+ gx_device_memory *mmask = NULL;
+ gx_device_memory *mbits = NULL;
if (code < 0)
return code;
pcache = pis->pattern_cache;
if (fdev->procs.open_device != pattern_clist_open_device) {
gx_device_pattern_accum *padev = (gx_device_pattern_accum *)fdev;
- gx_device_memory *mbits = padev->bits;
- gx_device_memory *mmask = padev->mask;
-
+
+ mbits = padev->bits;
+ mmask = padev->mask;
pinst = padev->instance;
/*
* Check whether the pattern completely fills its box.
@@ -696,8 +700,6 @@
ctile->is_dummy = false;
if (fdev->procs.open_device != pattern_clist_open_device) {
gx_device_pattern_accum *padev = (gx_device_pattern_accum *)fdev;
- gx_device_memory *mbits = padev->bits;
- gx_device_memory *mmask = padev->mask;
if (mbits != 0) {
make_bitmap(&ctile->tbits, mbits, gs_next_ids(pis->memory, 1));
More information about the gs-cvs
mailing list