summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/glyphcache.c31
-rw-r--r--render/rastport.c6
-rw-r--r--render/render.c4
3 files changed, 24 insertions, 17 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++];
diff --git a/render/rastport.c b/render/rastport.c
index 6d6b3b8a..a6dedf05 100644
--- a/render/rastport.c
+++ b/render/rastport.c
@@ -396,9 +396,9 @@ static void img_w3i1o4(byte *rgb, FZ_PSRC, FZ_PDST, FZ_PCTM)
sa = samplemask(src, srcw, srch, u, v);
ssa = 255 - sa;
dstp[0] = sa + fz_mul255(dstp[0], ssa);
- dstp[1] = rgb[0] + fz_mul255(dstp[1], ssa);
- dstp[2] = rgb[1] + fz_mul255(dstp[2], ssa);
- dstp[3] = rgb[2] + fz_mul255(dstp[3], ssa);
+ dstp[1] = rgb[0] + fz_mul255((short)dstp[1] - rgb[0], ssa);
+ dstp[2] = rgb[1] + fz_mul255((short)dstp[2] - rgb[1], ssa);
+ dstp[3] = rgb[2] + fz_mul255((short)dstp[3] - rgb[2], ssa);
dstp += 4;
u += fa;
v += fb;
diff --git a/render/render.c b/render/render.c
index 77f04e22..b72f069e 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1,7 +1,7 @@
#include <fitz.h>
-#define DEBUG(args...) printf(args)
-#define noDEBUG(args...)
+#define noDEBUG(args...) printf(args)
+#define DEBUG(args...)
#define FNONE 0
#define FOVER 1