summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gxbcache.c')
-rw-r--r--base/gxbcache.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/base/gxbcache.c b/base/gxbcache.c
index 184c7647..645f64d4 100644
--- a/base/gxbcache.c
+++ b/base/gxbcache.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -146,3 +146,35 @@ gx_bits_cache_free(gx_bits_cache * bc, gx_cached_bits_head * cbh,
cbh->size = size; /* gs_alloc_fill may have overwritten */
cb_head_set_free(cbh);
}
+
+#ifdef DEBUG
+/* A useful bit of code to dump the contents of the bitmap cache. Not
+ * currently called. Current position is indicated with a '>'. */
+void
+gx_bits_cache_dump(gx_bits_cache * bc)
+{
+ gx_bits_cache_chunk *bck = bc->chunks;
+ gx_bits_cache_chunk *first = bck;
+
+ dlprintf2("%d entries making %d bytes\n", bc->csize, bc->bsize);
+
+ do {
+ gx_cached_bits_head *cbh;
+ uint pos = 0;
+
+ dlprintf2(" chunk of %d bytes (%d allocated)\n", bck->size, bck->allocated);
+
+ cbh = (gx_cached_bits_head *)bck->data;
+ while (pos != bck->size) {
+ dlprintf3(" %csize=%d depth=%d\n",
+ pos == bc->cnext && bck == bc->chunks ? '>' : ' ',
+ cbh->size, cbh->depth);
+ pos += cbh->size;
+ cbh = (gx_cached_bits_head *)(((byte *)cbh) + cbh->size);
+ }
+ bck = bck->next;
+ } while (bck != first);
+
+ bck=bck;
+}
+#endif