diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-06-19 15:29:44 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2013-06-20 16:45:35 +0200 |
commit | 0a927854a10e1e6b9770a81e2e1d9f3093631757 (patch) | |
tree | 3d65d820d9fdba2d0d394d99c36290c851b78ca0 /source/pdf/pdf-xref-aux.c | |
parent | 1ae8f19179c5f0f8c6352b3c7855465325d5449a (diff) | |
download | mupdf-0a927854a10e1e6b9770a81e2e1d9f3093631757.tar.xz |
Rearrange source files.
Diffstat (limited to 'source/pdf/pdf-xref-aux.c')
-rw-r--r-- | source/pdf/pdf-xref-aux.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref-aux.c b/source/pdf/pdf-xref-aux.c new file mode 100644 index 00000000..48634374 --- /dev/null +++ b/source/pdf/pdf-xref-aux.c @@ -0,0 +1,39 @@ +#include "mupdf/pdf.h" + +/* + These functions have been split out of pdf_xref.c to allow tools + to be linked without pulling in the interpreter. The interpreter + references the built-in font and cmap resources which are quite + big. Not linking those into the tools saves roughly 6MB in the + resulting executables. +*/ + +static void pdf_run_page_contents_shim(fz_document *doc, fz_page *page, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +{ + pdf_run_page_contents((pdf_document*)doc, (pdf_page*)page, dev, transform, cookie); +} + +static void pdf_run_annot_shim(fz_document *doc, fz_page *page, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie) +{ + pdf_run_annot((pdf_document*)doc, (pdf_page*)page, (pdf_annot *)annot, dev, transform, cookie); +} + +pdf_document * +pdf_open_document_with_stream(fz_context *ctx, fz_stream *file) +{ + pdf_document *doc = pdf_open_document_no_run_with_stream(ctx, file); + doc->super.run_page_contents = pdf_run_page_contents_shim; + doc->super.run_annot = pdf_run_annot_shim; + doc->update_appearance = pdf_update_appearance; + return doc; +} + +pdf_document * +pdf_open_document(fz_context *ctx, const char *filename) +{ + pdf_document *doc = pdf_open_document_no_run(ctx, filename); + doc->super.run_page_contents = pdf_run_page_contents_shim; + doc->super.run_annot = pdf_run_annot_shim; + doc->update_appearance = pdf_update_appearance; + return doc; +} |