From 80f493b34eb72dfad76d06a97545e64afff84f78 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 15 Apr 2010 22:40:41 +0200 Subject: Make the glyph cache an input to fz_newdrawdevice so that it can be shared between pages. --- apps/pdfdraw.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'apps/pdfdraw.c') diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c index 14ec4afd..8f840bd0 100644 --- a/apps/pdfdraw.c +++ b/apps/pdfdraw.c @@ -50,6 +50,7 @@ struct benchmark int maxpage; }; +static fz_glyphcache *drawcache = nil; static int drawmode = DRAWPNM; static char *drawpattern = nil; static pdf_page *drawpage = nil; @@ -67,6 +68,11 @@ static void local_cleanup(void) pdf_dropstore(xref->store); xref->store = nil; } + if (drawcache) + { + fz_freeglyphcache(drawcache); + drawcache = nil; + } } static void drawusage(void) @@ -216,7 +222,7 @@ static void drawpnm(int pagenum, struct benchmark *loadtimes, struct benchmark * if (drawbands > 1) fprintf(stdout, "drawing band %d / %d\n", b + 1, drawbands); - dev = fz_newdrawdevice(pix); + dev = fz_newdrawdevice(drawcache, pix); drawpage->contents->rp = drawpage->contents->bp; error = pdf_runcontentstream(dev, ctm, xref, drawpage->resources, drawpage->contents); if (error) @@ -454,6 +460,8 @@ int main(int argc, char **argv) if (fz_optind == argc) drawusage(); + drawcache = fz_newglyphcache(512, 512*512); + setcleanup(local_cleanup); state = NO_FILE_OPENED; -- cgit v1.2.3