summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/glyphcache.c8
-rw-r--r--render/pixmap.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/render/glyphcache.c b/render/glyphcache.c
index 9fd4a5a7..6fc8bd52 100644
--- a/render/glyphcache.c
+++ b/render/glyphcache.c
@@ -114,6 +114,9 @@ static int hdist = 0;
static int coos = 0;
static int covf = 0;
+static int ghits = 0;
+static int gmisses = 0;
+
static fz_val *
hashfind(fz_glyphcache *arena, fz_key *key)
{
@@ -218,6 +221,7 @@ fz_debugglyphcache(fz_glyphcache *arena)
printf("avg dist: %d / %d: %g\n", hdist, hcoll, (double)hdist / hcoll);
printf("out-of-space evicts: %d\n", coos);
printf("out-of-hash evicts: %d\n", covf);
+ printf("hits = %d misses = %d ratio = %g\n", ghits, gmisses, (float)ghits / (ghits + gmisses));
/*
int i;
for (i = 0; i < arena->slots; i++)
@@ -333,9 +337,13 @@ fz_renderglyph(fz_glyphcache *arena, fz_glyph *glyph, fz_font *font, int cid, fz
bubble(arena, val - arena->lru);
+ ghits++;
+
return nil;
}
+ gmisses++;
+
ctm.e = fz_floor(ctm.e) + key.e / 256.0;
ctm.f = fz_floor(ctm.f) + key.f / 256.0;
diff --git a/render/pixmap.c b/render/pixmap.c
index c024a025..4e6823d9 100644
--- a/render/pixmap.c
+++ b/render/pixmap.c
@@ -76,8 +76,8 @@ fz_debugpixmap(fz_pixmap *pix)
if (pix->n == 4)
{
int x, y;
- FILE *ppm = fopen("out.ppm", "w");
- FILE *pgm = fopen("out.pgm", "w");
+ FILE *ppm = fopen("out.ppm", "wb");
+ FILE *pgm = fopen("out.pgm", "wb");
fprintf(ppm, "P6\n%d %d\n255\n", pix->w, pix->h);
fprintf(pgm, "P5\n%d %d\n255\n", pix->w, pix->h);
@@ -100,7 +100,7 @@ fz_debugpixmap(fz_pixmap *pix)
else if (pix->n == 2)
{
int x, y;
- FILE *pgm = fopen("out.pgm", "w");
+ FILE *pgm = fopen("out.pgm", "wb");
fprintf(pgm, "P5\n%d %d\n255\n", pix->w, pix->h);
for (y = 0; y < pix->h; y++)