summaryrefslogtreecommitdiff
path: root/render/glyphcache.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-11-25 10:42:53 +0100
committerTor Andersson <tor@ghostscript.com>2004-11-25 10:42:53 +0100
commite8696b4046767fcbfc05056c13f919fdeff65158 (patch)
treeac03d0f565f8ad74818a9486cfbadc1d730c35ee /render/glyphcache.c
parent6a2ce62be0518a6e5690d6a1d23527ede5a91150 (diff)
downloadmupdf-e8696b4046767fcbfc05056c13f919fdeff65158.tar.xz
join content streams
Diffstat (limited to 'render/glyphcache.c')
-rw-r--r--render/glyphcache.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/render/glyphcache.c b/render/glyphcache.c
index 57b2ce84..5364230b 100644
--- a/render/glyphcache.c
+++ b/render/glyphcache.c
@@ -285,7 +285,7 @@ evictlast(fz_glyphcache *arena)
arena->used -= e - s;
/* update lru pointers */
- for (i = 0; i < k; i++)
+ for (i = 0; i < k; i++) /* XXX this is DOG slow! XXX */
if (lru[i].samples >= e)
lru[i].samples -= e - s;
@@ -296,6 +296,17 @@ evictlast(fz_glyphcache *arena)
arena->load --;
}
+static void
+evictall(fz_glyphcache *arena)
+{
+printf("zap!\n");
+ memset(arena->hash, 0, sizeof(fz_hash) * arena->slots);
+ memset(arena->lru, 0, sizeof(fz_val) * arena->slots);
+ memset(arena->buffer, 0, arena->size);
+ arena->load = 0;
+ arena->used = 0;
+}
+
fz_error *
fz_renderglyph(fz_glyphcache *arena, fz_glyph *glyph, fz_font *font, int cid, fz_matrix ctm)
{
@@ -342,20 +353,16 @@ fz_renderglyph(fz_glyphcache *arena, fz_glyph *glyph, fz_font *font, int cid, fz
while (arena->load > arena->slots * 75 / 100)
{
- while (arena->load > arena->slots * 60 / 100)
- {
- covf ++;
- evictlast(arena);
- }
+ covf ++;
+// evictlast(arena);
+ evictall(arena);
}
- if (arena->used + size >= arena->size)
+ while (arena->used + size >= arena->size)
{
- while (arena->used + size >= arena->size * 80 / 100)
- {
- coos ++;
- evictlast(arena);
- }
+ coos ++;
+// evictlast(arena);
+ evictall(arena);
}
val = &arena->lru[arena->load++];