summaryrefslogtreecommitdiff
path: root/apps/pdfapp.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-04-15 22:40:41 +0200
committerTor Andersson <tor@ghostscript.com>2010-04-15 22:40:41 +0200
commit80f493b34eb72dfad76d06a97545e64afff84f78 (patch)
treee048b299da91aba52b878eab6242780f9f896bfc /apps/pdfapp.c
parentbd7e94651b00d884ffb0a5349182d99a87396a6d (diff)
downloadmupdf-80f493b34eb72dfad76d06a97545e64afff84f78.tar.xz
Make the glyph cache an input to fz_newdrawdevice so that it can be shared between pages.
Diffstat (limited to 'apps/pdfapp.c')
-rw-r--r--apps/pdfapp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 499502ca..e4aaa07b 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -56,6 +56,7 @@ void pdfapp_init(pdfapp_t *app)
app->scrw = 640;
app->scrh = 480;
app->zoom = 1.0;
+ app->cache = fz_newglyphcache(512, 512 * 512);
}
void pdfapp_open(pdfapp_t *app, char *filename)
@@ -133,6 +134,10 @@ void pdfapp_open(pdfapp_t *app, char *filename)
void pdfapp_close(pdfapp_t *app)
{
+ if (app->cache)
+ fz_freeglyphcache(app->cache);
+ app->cache = nil;
+
if (app->page)
pdf_droppage(app->page);
app->page = nil;
@@ -241,7 +246,7 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage)
fz_droppixmap(app->image);
app->image = fz_newpixmapwithrect(pdf_devicergb, bbox);
fz_clearpixmap(app->image, 0xFF);
- idev = fz_newdrawdevice(app->image);
+ idev = fz_newdrawdevice(app->cache, app->image);
fz_executedisplaylist(list, idev, ctm);
fz_freedevice(idev);