[gs-cvs] rev 7856 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Mon Apr 16 16:55:59 PDT 2007
Author: leonardo
Date: 2007-04-16 16:55:59 -0700 (Mon, 16 Apr 2007)
New Revision: 7856
Modified:
trunk/gs/src/gxclist.c
trunk/gs/src/gxpcmap.c
Log:
Implementing high level patterns, step 6.
DETAILS :
This is a preparation for fixing the bug 688396, step 6.
This change is algorithmically equivalent :
the new behavior is temporarily disabled with
MAX_BITMAP_PATTERN_SIZE macro.
This patch :
1. Implements the memory cleanup when a clist-based pattern cache entry purges.
2. Disables tile cache for clist-based patterns.
3. Disables the processing of uncolored patterns as large patterns.
This code needs improvements :
2. Large uncolored patterns are not implemented.
3. Get rid of non_gc_memory in the pattern clist writer.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxclist.c
===================================================================
--- trunk/gs/src/gxclist.c 2007-04-16 18:53:12 UTC (rev 7855)
+++ trunk/gs/src/gxclist.c 2007-04-16 23:55:59 UTC (rev 7856)
@@ -26,6 +26,8 @@
#include "gsparams.h"
#include "gxdcolor.h"
+extern dev_proc_open_device(pattern_clist_open_device);
+
/* GC information */
extern_st(st_imager_state);
private
@@ -272,7 +274,6 @@
gx_device_clist_writer * const cdev =
&((gx_device_clist *)dev)->writer;
int nbands;
- extern dev_proc_open_device(pattern_clist_open_device);
if (dev->procs.open_device == pattern_clist_open_device) {
/* We don't need bands really. */
@@ -344,6 +345,7 @@
gx_device_memory bdev;
gx_device *pbdev = (gx_device *)&bdev;
int code;
+ extern dev_proc_open_device(pattern_clist_open_device);
/* Call create_buf_device to get the memory planarity set up. */
cdev->buf_procs.create_buf_device(&pbdev, target, NULL, NULL, clist_get_band_complexity(0, 0));
@@ -351,7 +353,9 @@
/* copy_alpha in the commmand list device as well. */
if (dev_proc(pbdev, copy_alpha) == gx_no_copy_alpha)
cdev->disable_mask |= clist_disable_copy_alpha;
- if (band_height) {
+ if (cdev->procs.open_device == pattern_clist_open_device) {
+ bits_size = 0;
+ } else if (band_height) {
/*
* The band height is fixed, so the band buffer requirement
* is completely determined.
@@ -362,6 +366,9 @@
if (band_data_size >= band_space)
return_error(gs_error_rangecheck);
bits_size = min(band_space - band_data_size, data_size >> 1);
+ code = clist_init_tile_cache(dev, data, bits_size);
+ if (code < 0)
+ return code;
} else {
/*
* Choose the largest band height that will fit in the
@@ -373,10 +380,10 @@
band_space - bits_size, page_uses_transparency);
if (band_height == 0)
return_error(gs_error_rangecheck);
+ code = clist_init_tile_cache(dev, data, bits_size);
+ if (code < 0)
+ return code;
}
- code = clist_init_tile_cache(dev, data, bits_size);
- if (code < 0)
- return code;
cdev->page_tile_cache_size = bits_size;
data += bits_size;
size -= bits_size;
@@ -403,7 +410,8 @@
cdev->permanent_error = 0;
nbands = cdev->nbands;
cdev->ymin = cdev->ymax = -1; /* render_init not done yet */
- memset(cdev->tile_table, 0, (cdev->tile_hash_mask + 1) *
+ if (cdev->procs.open_device != pattern_clist_open_device)
+ memset(cdev->tile_table, 0, (cdev->tile_hash_mask + 1) *
sizeof(*cdev->tile_table));
cdev->cnext = cdev->cbuf;
cdev->ccl = 0;
@@ -622,7 +630,6 @@
{
gx_device_clist_writer * const cdev =
&((gx_device_clist *)dev)->writer;
- extern dev_proc_open_device(pattern_clist_open_device);
if (cdev->do_not_open_or_close_bandfiles)
return 0;
Modified: trunk/gs/src/gxpcmap.c
===================================================================
--- trunk/gs/src/gxpcmap.c 2007-04-16 18:53:12 UTC (rev 7855)
+++ trunk/gs/src/gxpcmap.c 2007-04-16 23:55:59 UTC (rev 7856)
@@ -186,7 +186,7 @@
int64_t size = (int64_t)raster * pinst->size.y;
gx_device_forward *fdev;
- if (size < MAX_BITMAP_PATTERN_SIZE) {
+ if (size < MAX_BITMAP_PATTERN_SIZE || pinst->template.PaintType != 1) {
gx_device_pattern_accum *adev = gs_alloc_struct(mem, gx_device_pattern_accum,
&st_device_pattern_accum, cname);
@@ -272,7 +272,7 @@
cwdev->band_params.page_uses_transparency = false;
cwdev->band_params.BandWidth = pinst->size.x;
cwdev->band_params.BandHeight = pinst->size.x;
- cwdev->band_params.BandBufferSpace = max_long;
+ cwdev->band_params.BandBufferSpace = 0;
cwdev->do_not_open_or_close_bandfiles = false;
cwdev->bandlist_memory = storage_memory->non_gc_memory;
cwdev->free_up_bandlist_memory = dummy_free_up_bandlist_memory;
@@ -600,6 +600,10 @@
"free_pattern_cache_entry(bits data)");
ctile->tbits.data = 0; /* for GC */
}
+ if (ctile->cdev != NULL) {
+ dev_proc(&ctile->cdev->common, close_device)((gx_device *)&ctile->cdev->common);
+ ctile->cdev = NULL;
+ }
ctile->id = gx_no_bitmap_id;
pcache->tiles_used--;
}
@@ -876,10 +880,10 @@
return code;
fail:
if (adev->procs.open_device == pattern_clist_open_device) {
- gx_device_clist *pdev = (gx_device_clist *)adev;
+ gx_device_clist *cdev = (gx_device_clist *)adev;
- gs_free_object(mem, pdev->common.data, "gx_pattern_load");
- pdev->common.data = 0;
+ gs_free_object(cdev->writer.bandlist_memory, cdev->common.data, "gx_pattern_load");
+ cdev->common.data = 0;
}
gs_free_object(mem, adev, "gx_pattern_load");
return code;
More information about the gs-cvs
mailing list