summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/fitz/list-device.c12
-rw-r--r--source/fitz/stext-device.c14
-rw-r--r--source/fitz/test-device.c1
-rw-r--r--source/pdf/pdf-op-run.c16
-rw-r--r--source/tools/mudraw.c6
5 files changed, 23 insertions, 26 deletions
diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c
index 49a93c20..6580b93c 100644
--- a/source/fitz/list-device.c
+++ b/source/fitz/list-device.c
@@ -1646,20 +1646,16 @@ visible:
fz_ignore_text(ctx, dev, *(fz_text **)node, &trans_ctm);
break;
case FZ_CMD_FILL_SHADE:
- if ((dev->hints & FZ_IGNORE_SHADE) == 0)
- fz_fill_shade(ctx, dev, *(fz_shade **)node, &trans_ctm, alpha);
+ fz_fill_shade(ctx, dev, *(fz_shade **)node, &trans_ctm, alpha);
break;
case FZ_CMD_FILL_IMAGE:
- if ((dev->hints & FZ_IGNORE_IMAGE) == 0)
- fz_fill_image(ctx, dev, *(fz_image **)node, &trans_ctm, alpha);
+ fz_fill_image(ctx, dev, *(fz_image **)node, &trans_ctm, alpha);
break;
case FZ_CMD_FILL_IMAGE_MASK:
- if ((dev->hints & FZ_IGNORE_IMAGE) == 0)
- fz_fill_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, colorspace, color, alpha);
+ fz_fill_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, colorspace, color, alpha);
break;
case FZ_CMD_CLIP_IMAGE_MASK:
- if ((dev->hints & FZ_IGNORE_IMAGE) == 0)
- fz_clip_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, &trans_rect);
+ fz_clip_image_mask(ctx, dev, *(fz_image **)node, &trans_ctm, &trans_rect);
break;
case FZ_CMD_POP_CLIP:
fz_pop_clip(ctx, dev);
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index 0890043f..78755595 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -1095,6 +1095,8 @@ fz_parse_stext_options(fz_context *ctx, fz_stext_options *opts, const char *stri
opts->flags |= FZ_STEXT_PRESERVE_LIGATURES;
if (fz_has_option(ctx, string, "preserve-whitespace", &val) && fz_option_eq(val, "yes"))
opts->flags |= FZ_STEXT_PRESERVE_WHITESPACE;
+ if (fz_has_option(ctx, string, "preserve-images", &val) && fz_option_eq(val, "yes"))
+ opts->flags |= FZ_STEXT_PRESERVE_IMAGES;
return opts;
}
@@ -1104,8 +1106,6 @@ fz_new_stext_device(fz_context *ctx, fz_stext_sheet *sheet, fz_stext_page *page,
{
fz_stext_device *dev = fz_new_derived_device(ctx, fz_stext_device);
- dev->super.hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
-
dev->super.close_device = fz_stext_close_device;
dev->super.drop_device = fz_stext_drop_device;
@@ -1114,16 +1114,18 @@ fz_new_stext_device(fz_context *ctx, fz_stext_sheet *sheet, fz_stext_page *page,
dev->super.clip_text = fz_stext_clip_text;
dev->super.clip_stroke_text = fz_stext_clip_stroke_text;
dev->super.ignore_text = fz_stext_ignore_text;
- dev->super.fill_image = fz_stext_fill_image;
- dev->super.fill_image_mask = fz_stext_fill_image_mask;
+
+ if (opts && (opts->flags & FZ_STEXT_PRESERVE_IMAGES))
+ {
+ dev->super.fill_image = fz_stext_fill_image;
+ dev->super.fill_image_mask = fz_stext_fill_image_mask;
+ }
dev->sheet = sheet;
dev->page = page;
dev->spans = NULL;
dev->cur_span = NULL;
dev->lastchar = ' ';
- if (opts)
- dev->flags = opts->flags;
return (fz_device*)dev;
}
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index f12a294b..38dc331b 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -53,7 +53,6 @@ fz_test_color(fz_context *ctx, fz_test_device *t, fz_colorspace *colorspace, con
t->resolved = 1;
if (t->passthrough == NULL)
{
- t->super.hints |= FZ_IGNORE_IMAGE;
fz_throw(ctx, FZ_ERROR_ABORT, "Page found as color; stopping interpretation");
}
}
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 */
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 086220ab..ef95f1d3 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -510,16 +510,16 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
fz_try(ctx)
{
fz_rect mediabox;
+ fz_stext_options stext_options;
if (list)
fz_bound_display_list(ctx, list, &mediabox);
else
fz_bound_page(ctx, page, &mediabox);
+ stext_options.flags = (output_format == OUT_HTML) ? FZ_STEXT_PRESERVE_IMAGES : 0;
text = fz_new_stext_page(ctx, &mediabox);
- dev = fz_new_stext_device(ctx, sheet, text, 0);
+ dev = fz_new_stext_device(ctx, sheet, text, &stext_options);
if (lowmemory)
fz_enable_device_hints(ctx, dev, FZ_NO_CACHE);
- if (output_format == OUT_HTML)
- fz_disable_device_hints(ctx, dev, FZ_IGNORE_IMAGE);
if (list)
fz_run_display_list(ctx, list, dev, &fz_identity, &fz_infinite_rect, cookie);
else