summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-09-06 13:46:23 +0100
committerRobin Watts <robin.watts@artifex.com>2012-09-21 10:58:19 +0100
commit33433b148528ae863f651f49486e20bbcd6ebbb2 (patch)
tree65eef171ac4003da73ad9f76d211ccec2defb5d5
parent9e609e1dcf6a1dac9195a4cfecac2a573ba42433 (diff)
downloadmupdf-33433b148528ae863f651f49486e20bbcd6ebbb2.tar.xz
Move defaulting of image params into predictor function.
This makes no difference to the current operation of the code, but ensures that 'saner' values are put into the image_params structure. This will help pdfwrite give more aesthetically pleasing output later.
-rw-r--r--fitz/filt_predict.c9
-rw-r--r--pdf/pdf_stream.c5
2 files changed, 9 insertions, 5 deletions
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c
index b82c1281..015d4a13 100644
--- a/fitz/filt_predict.c
+++ b/fitz/filt_predict.c
@@ -199,6 +199,15 @@ fz_open_predict(fz_stream *chain, int predictor, int columns, int colors, int bp
fz_var(state);
+ if (predictor < 1)
+ predictor = 1;
+ if (columns < 1)
+ columns = 1;
+ if (colors < 1)
+ colors = 1;
+ if (bpc < 1)
+ bpc = 8;
+
fz_try(ctx)
{
state = fz_malloc_struct(ctx, fz_predict);
diff --git a/pdf/pdf_stream.c b/pdf/pdf_stream.c
index a81ecb18..b8a8f5c6 100644
--- a/pdf/pdf_stream.c
+++ b/pdf/pdf_stream.c
@@ -58,11 +58,6 @@ build_filter(fz_stream *chain, pdf_document * xref, pdf_obj * f, pdf_obj * p, in
int colors = pdf_to_int(pdf_dict_gets(p, "Colors"));
int bpc = pdf_to_int(pdf_dict_gets(p, "BitsPerComponent"));
- if (predictor <= 0) predictor = 1;
- if (columns <= 0) columns = 1;
- if (colors <= 0) colors = 1;
- if (bpc <= 0) bpc = 8;
-
if (!strcmp(s, "ASCIIHexDecode") || !strcmp(s, "AHx"))
return fz_open_ahxd(chain);