1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Definition of Pattern cache */
18 
19 #ifndef gxpcache_INCLUDED
20 #  define gxpcache_INCLUDED
21 
22 #include "std.h"
23 #include "gsdcolor.h"
24 
25 /*
26  * Define a cache for rendered Patterns.  This is currently an open
27  * hash table with single probing (no reprobing) and round-robin
28  * replacement.  Obviously, we can do better in both areas.
29  */
30 typedef struct gx_pattern_cache_s gx_pattern_cache;
31 
32 struct gx_pattern_cache_s {
33     gs_memory_t *memory;
34     gx_color_tile *tiles;
35     uint num_tiles;
36     uint tiles_used;
37     uint next;			/* round-robin index */
38     ulong bits_used;
39     ulong max_bits;
40     void (*free_all) (gx_pattern_cache *);
41 };
42 
43 #define private_st_pattern_cache() /* in gxpcmap.c */\
44   gs_private_st_ptrs1(st_pattern_cache, gx_pattern_cache,\
45     "gx_pattern_cache", pattern_cache_enum, pattern_cache_reloc, tiles)
46 
47 #endif /* gxpcache_INCLUDED */
48