summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-run.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-11-09 17:41:43 +0000
committerRobin Watts <robin.watts@artifex.com>2016-11-11 13:18:39 +0000
commitda50c6f300e565c8eedf4ce252c44b5ddbb95cee (patch)
treed63891b1494b45046973cbc1ab3b4435821fc3f1 /source/pdf/pdf-run.c
parenta1d18b804019ad89841f289c465755d7feebe823 (diff)
downloadmupdf-da50c6f300e565c8eedf4ce252c44b5ddbb95cee.tar.xz
Add pdf_layer configuration API.
Add API to: * allow enumeration of layer configs (OCCDs) within PDF files. * allow selection of layer configs. * allow enumeration of the "UI" (or "Human readable") form of layer configs. * allow selection/toggling of entries in the UI.
Diffstat (limited to 'source/pdf/pdf-run.c')
-rw-r--r--source/pdf/pdf-run.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/pdf/pdf-run.c b/source/pdf/pdf-run.c
index f806b120..ba8b30b7 100644
--- a/source/pdf/pdf-run.c
+++ b/source/pdf/pdf-run.c
@@ -1,7 +1,7 @@
#include "mupdf/pdf.h"
static void
-pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_annot *annot, fz_device *dev, const fz_matrix *ctm, char *event, fz_cookie *cookie)
+pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_annot *annot, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie)
{
fz_matrix local_ctm, page_ctm;
fz_rect mediabox;
@@ -10,7 +10,7 @@ pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf
pdf_page_transform(ctx, page, &mediabox, &page_ctm);
fz_concat(&local_ctm, &page_ctm, ctm);
- proc = pdf_new_run_processor(ctx, dev, &local_ctm, event, NULL, 0);
+ proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0);
fz_try(ctx)
pdf_process_annot(ctx, proc, doc, page, annot, cookie);
fz_always(ctx)
@@ -19,7 +19,8 @@ pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf
fz_rethrow(ctx);
}
-static void pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, char *event, fz_cookie *cookie)
+static void
+pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie)
{
fz_matrix local_ctm, page_ctm;
pdf_obj *resources;
@@ -36,7 +37,7 @@ static void pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc,
if (page->transparency)
fz_begin_group(ctx, dev, fz_transform_rect(&mediabox, &local_ctm), 1, 0, 0, 1);
- proc = pdf_new_run_processor(ctx, dev, &local_ctm, event, NULL, 0);
+ proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0);
fz_try(ctx)
pdf_process_contents(ctx, proc, doc, resources, contents, cookie);
fz_always(ctx)
@@ -100,7 +101,8 @@ void pdf_run_annot(fz_context *ctx, pdf_annot *annot, fz_device *dev, const fz_m
fz_throw(ctx, FZ_ERROR_TRYLATER, "incomplete rendering");
}
-static void pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, char *event, fz_cookie *cookie)
+static void
+pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie)
{
pdf_annot *annot;
@@ -122,12 +124,12 @@ static void pdf_run_page_annots_with_usage(fz_context *ctx, pdf_document *doc, p
cookie->progress++;
}
- pdf_run_annot_with_usage(ctx, doc, page, annot, dev, ctm, event, cookie);
+ pdf_run_annot_with_usage(ctx, doc, page, annot, dev, ctm, usage, cookie);
}
}
void
-pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, char *event, fz_cookie *cookie)
+pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, const char *usage, fz_cookie *cookie)
{
int nocache = !!(dev->hints & FZ_NO_CACHE);
@@ -135,8 +137,8 @@ pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_d
pdf_mark_xref(ctx, doc);
fz_try(ctx)
{
- pdf_run_page_contents_with_usage(ctx, doc, page, dev, ctm, event, cookie);
- pdf_run_page_annots_with_usage(ctx, doc, page, dev, ctm, event, cookie);
+ pdf_run_page_contents_with_usage(ctx, doc, page, dev, ctm, usage, cookie);
+ pdf_run_page_annots_with_usage(ctx, doc, page, dev, ctm, usage, cookie);
}
fz_always(ctx)
{