diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-09-14 17:36:57 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-09-15 14:50:17 +0100 |
commit | b51ef0eea028c73b6379e832eaa34fff3fbbb927 (patch) | |
tree | 1ab685ccd356e7fdc832b2e3322c0486b2670cfb /apps/x11_main.c | |
parent | 89ae81f651bfa112b8e07317eb6983beaf7cb212 (diff) | |
download | mupdf-b51ef0eea028c73b6379e832eaa34fff3fbbb927.tar.xz |
Add context to mupdf.
Huge pervasive change to lots of files, adding a context for exception
handling and allocation.
In time we'll move more statics into there.
Also fix some for(i = 0; i < function(...); i++) calls.
Diffstat (limited to 'apps/x11_main.c')
-rw-r--r-- | apps/x11_main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/x11_main.c b/apps/x11_main.c index d719abda..f0f4f66d 100644 --- a/apps/x11_main.c +++ b/apps/x11_main.c @@ -554,6 +554,7 @@ int main(int argc, char **argv) fd_set fds; int width = -1; int height = -1; + fz_context *ctx; while ((c = fz_getopt(argc, argv, "p:r:b:A")) != -1) { @@ -583,9 +584,16 @@ int main(int argc, char **argv) if (accelerate) fz_accelerate(); + ctx = fz_context_init(&fz_alloc_default); + if (ctx == NULL) + { + fprintf(stderr, "failed to initialise context"); + exit(1); + } + winopen(); - pdfapp_init(&gapp); + pdfapp_init(ctx, &gapp); gapp.scrw = DisplayWidth(xdpy, xscr); gapp.scrh = DisplayHeight(xdpy, xscr); gapp.resolution = resolution; @@ -742,5 +750,7 @@ int main(int argc, char **argv) XCloseDisplay(xdpy); + fz_context_fin(ctx); + return 0; } |