diff options
Diffstat (limited to 'source/pdf/pdf-run.c')
-rw-r--r-- | source/pdf/pdf-run.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/pdf/pdf-run.c b/source/pdf/pdf-run.c index b1de0342..1436e93a 100644 --- a/source/pdf/pdf-run.c +++ b/source/pdf/pdf-run.c @@ -6,25 +6,29 @@ pdf_run_annot_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf { fz_matrix local_ctm, page_ctm; fz_rect mediabox; - pdf_processor *proc; + pdf_processor *proc = NULL; fz_default_colorspaces *default_cs; + fz_var(proc); + default_cs = pdf_load_default_colorspaces(ctx, doc, page); if (default_cs) fz_set_default_colorspaces(ctx, dev, default_cs); - fz_drop_default_colorspaces(ctx, default_cs); pdf_page_transform(ctx, page, &mediabox, &page_ctm); fz_concat(&local_ctm, &page_ctm, ctm); - proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0); fz_try(ctx) { + proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0, default_cs); pdf_process_annot(ctx, proc, doc, page, annot, cookie); pdf_close_processor(ctx, proc); } fz_always(ctx) + { pdf_drop_processor(ctx, proc); + fz_drop_default_colorspaces(ctx, default_cs); + } fz_catch(ctx) fz_rethrow(ctx); } @@ -76,7 +80,7 @@ pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *p fz_drop_colorspace(ctx, colorspace); } - proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0); + proc = pdf_new_run_processor(ctx, dev, &local_ctm, usage, NULL, 0, default_cs); pdf_process_contents(ctx, proc, doc, resources, contents, cookie); pdf_close_processor(ctx, proc); } @@ -204,14 +208,14 @@ pdf_run_page(fz_context *ctx, pdf_page *page, fz_device *dev, const fz_matrix *c } void -pdf_run_glyph(fz_context *ctx, pdf_document *doc, pdf_obj *resources, fz_buffer *contents, fz_device *dev, const fz_matrix *ctm, void *gstate, int nested_depth) +pdf_run_glyph(fz_context *ctx, pdf_document *doc, pdf_obj *resources, fz_buffer *contents, fz_device *dev, const fz_matrix *ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs) { pdf_processor *proc; if (nested_depth > 10) fz_throw(ctx, FZ_ERROR_GENERIC, "Too many nestings of Type3 glyphs"); - proc = pdf_new_run_processor(ctx, dev, ctm, "View", gstate, nested_depth+1); + proc = pdf_new_run_processor(ctx, dev, ctm, "View", gstate, nested_depth+1, default_cs); fz_try(ctx) { pdf_process_glyph(ctx, proc, doc, resources, contents); |