xref: /plan9/sys/src/cmd/gs/src/gxpcache.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1997 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gxpcache.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */
18 /* Definition of Pattern cache */
19 
20 #ifndef gxpcache_INCLUDED
21 #  define gxpcache_INCLUDED
22 
23 /*
24  * Define a cache for rendered Patterns.  This is currently an open
25  * hash table with single probing (no reprobing) and round-robin
26  * replacement.  Obviously, we can do better in both areas.
27  */
28 #ifndef gx_pattern_cache_DEFINED
29 #  define gx_pattern_cache_DEFINED
30 typedef struct gx_pattern_cache_s gx_pattern_cache;
31 
32 #endif
33 #ifndef gx_color_tile_DEFINED
34 #  define gx_color_tile_DEFINED
35 typedef struct gx_color_tile_s gx_color_tile;
36 
37 #endif
38 struct gx_pattern_cache_s {
39     gs_memory_t *memory;
40     gx_color_tile *tiles;
41     uint num_tiles;
42     uint tiles_used;
43     uint next;			/* round-robin index */
44     ulong bits_used;
45     ulong max_bits;
46     void (*free_all) (gx_pattern_cache *);
47 };
48 
49 #define private_st_pattern_cache() /* in gxpcmap.c */\
50   gs_private_st_ptrs1(st_pattern_cache, gx_pattern_cache,\
51     "gx_pattern_cache", pattern_cache_enum, pattern_cache_reloc, tiles)
52 
53 #endif /* gxpcache_INCLUDED */
54