diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-05 16:28:04 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-06 15:49:55 +0200 |
commit | c3944e2e1cfb4ac86a8580829376357e1d5bccda (patch) | |
tree | 974a632f212a9af950146a211825c5e8b361cef3 /source/pdf/pdf-xref.c | |
parent | 467af4f7b516b97ca082be794c8c462e4dea41ad (diff) | |
download | mupdf-c3944e2e1cfb4ac86a8580829376357e1d5bccda.tar.xz |
Add fitz to pdf downcasting functions for pages and annotations.
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r-- | source/pdf/pdf-xref.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 19b1f4f7..82fe7db1 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -2698,9 +2698,24 @@ pdf_obj *pdf_progressive_advance(fz_context *ctx, pdf_document *doc, int pagenum return doc->linear_page_refs[pagenum]; } +pdf_document *pdf_document_from_fz_document(fz_context *ctx, fz_document *ptr) +{ + return (pdf_document *)((ptr && ptr->count_pages == (void*)pdf_count_pages) ? ptr : NULL); +} + +pdf_page *pdf_page_from_fz_page(fz_context *ctx, fz_page *ptr) +{ + return (pdf_page *)((ptr && ptr->bound_page == (void*)pdf_bound_page) ? ptr : NULL); +} + +pdf_annot *pdf_annot_from_fz_annot(fz_context *ctx, fz_annot *ptr) +{ + return (pdf_annot *)((ptr && ptr->bound_annot == (void*)pdf_bound_annot) ? ptr : NULL); +} + pdf_document *pdf_specifics(fz_context *ctx, fz_document *doc) { - return (pdf_document *)((doc && doc->close == (fz_document_close_fn *)pdf_close_document) ? doc : NULL); + return pdf_document_from_fz_document(ctx, doc); } pdf_obj * |