diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-05-11 14:51:11 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-05-11 14:51:11 +0200 |
commit | e54d4225e2d16d2b5cc928294009fce0a5b30718 (patch) | |
tree | 1732eb253ecbcd8e72e5d13fc3062944a57d9627 /pdf/pdf_xref_aux.c | |
parent | 314c9ecaaba711741ecc5bb3e3e1e62655cee8c4 (diff) | |
download | mupdf-e54d4225e2d16d2b5cc928294009fce0a5b30718.tar.xz |
Split part of fz_document interface for pdf_document into separate file.
Make a separate constructor function that does not link in the
interpreter, so we can save space in the mubusy binary by not
including the font and cmap resources.
Diffstat (limited to 'pdf/pdf_xref_aux.c')
-rw-r--r-- | pdf/pdf_xref_aux.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pdf/pdf_xref_aux.c b/pdf/pdf_xref_aux.c new file mode 100644 index 00000000..2d760334 --- /dev/null +++ b/pdf/pdf_xref_aux.c @@ -0,0 +1,31 @@ +#include "fitz-internal.h" +#include "mupdf-internal.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_shim(fz_document *doc, fz_page *page, fz_device *dev, fz_matrix transform, fz_cookie *cookie) +{ + pdf_run_page((pdf_document*)doc, (pdf_page*)page, dev, transform, cookie); +} + +pdf_document * +pdf_open_document_with_stream(fz_stream *file) +{ + pdf_document *doc = pdf_open_document_no_run_with_stream(file); + doc->super.run_page = pdf_run_page_shim; + 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 = pdf_run_page_shim; + return doc; +} |