diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-05-25 12:00:21 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-05-25 12:28:00 +0200 |
commit | 32599868df1b3ecd553a0c1bc3e2521dd11b288a (patch) | |
tree | 31ea9a6e6c42ed560e19f3d8b655d2f29286d786 /source/pdf | |
parent | f01a11057f3352330bacd411160db1c2a032a1dc (diff) | |
download | mupdf-32599868df1b3ecd553a0c1bc3e2521dd11b288a.tar.xz |
Replace broken FZ_IGNORE_IMAGE hints with other mechanisms.
Add an option to the structured text device to preserve images.
If the PDF processor does not have ops to process images, then skip
loading them in the interpreter if possible. If the device does not
have any image callbacks, then don't set the image processing ops in
the run device.
This accomplishes the same effect as the device hints were intended
to do, but without needing to expose them to the PDF interpreter
which may not even have a device since we now have multiple PDF op
processors.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-op-run.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index a71309d8..22721173 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -1946,22 +1946,19 @@ static void pdf_run_rg(fz_context *ctx, pdf_processor *proc, float r, float g, f static void pdf_run_BI(fz_context *ctx, pdf_processor *proc, fz_image *image) { pdf_run_processor *pr = (pdf_run_processor *)proc; - if ((pr->dev->hints & FZ_IGNORE_IMAGE) == 0) - pdf_show_image(ctx, pr, image); + pdf_show_image(ctx, pr, image); } static void pdf_run_sh(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade) { pdf_run_processor *pr = (pdf_run_processor *)proc; - if ((pr->dev->hints & FZ_IGNORE_SHADE) == 0) - pdf_show_shade(ctx, pr, shade); + pdf_show_shade(ctx, pr, shade); } static void pdf_run_Do_image(fz_context *ctx, pdf_processor *proc, const char *name, fz_image *image) { pdf_run_processor *pr = (pdf_run_processor *)proc; - if ((pr->dev->hints & FZ_IGNORE_IMAGE) == 0) - pdf_show_image(ctx, pr, image); + pdf_show_image(ctx, pr, image); } static void pdf_run_Do_form(fz_context *ctx, pdf_processor *proc, const char *name, pdf_xobject *xobj, pdf_obj *page_resources) @@ -2133,9 +2130,12 @@ pdf_new_run_processor(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, con proc->super.op_k = pdf_run_k; /* shadings, images, xobjects */ - proc->super.op_BI = pdf_run_BI; proc->super.op_sh = pdf_run_sh; - proc->super.op_Do_image = pdf_run_Do_image; + if (dev->fill_image || dev->fill_image_mask || dev->clip_image_mask) + { + proc->super.op_BI = pdf_run_BI; + proc->super.op_Do_image = pdf_run_Do_image; + } proc->super.op_Do_form = pdf_run_Do_form; /* marked content */ |