summaryrefslogtreecommitdiff
path: root/fitz/filt_predict.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-01-27 15:49:00 +0100
committerRobin Watts <robin.watts@artifex.com>2012-01-27 18:03:34 +0000
commit4623d8d77b3b971208d93b61ebcb6e2de153c110 (patch)
tree3b03311b6b8a6d4da666f55bb13909a1ec8b77bd /fitz/filt_predict.c
parent50923a2d9da9023e846bacdf8cc5cc7961c17f7d (diff)
downloadmupdf-4623d8d77b3b971208d93b61ebcb6e2de153c110.tar.xz
Remove dependency on fz_obj from the filter creation parameters.
Diffstat (limited to 'fitz/filt_predict.c')
-rw-r--r--fitz/filt_predict.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c
index 30393e54..45baf86b 100644
--- a/fitz/filt_predict.c
+++ b/fitz/filt_predict.c
@@ -187,12 +187,12 @@ close_predict(fz_context *ctx, void *state_)
fz_free(ctx, state);
}
+/* Default values: predictor = 1, columns = 1, colors = 1, bpc = 8 */
fz_stream *
-fz_open_predict(fz_stream *chain, fz_obj *params)
+fz_open_predict(fz_stream *chain, int predictor, int columns, int colors, int bpc)
{
- fz_predict *state = NULL;
- fz_obj *obj;
fz_context *ctx = chain->ctx;
+ fz_predict *state = NULL;
fz_var(state);
@@ -203,14 +203,10 @@ fz_open_predict(fz_stream *chain, fz_obj *params)
state->out = NULL;
state->chain = chain;
- state->predictor = 1;
- state->columns = 1;
- state->colors = 1;
- state->bpc = 8;
-
- obj = fz_dict_gets(params, "Predictor");
- if (obj)
- state->predictor = fz_to_int(obj);
+ state->predictor = predictor;
+ state->columns = columns;
+ state->colors = colors;
+ state->bpc = bpc;
if (state->predictor != 1 && state->predictor != 2 &&
state->predictor != 10 && state->predictor != 11 &&
@@ -221,18 +217,6 @@ fz_open_predict(fz_stream *chain, fz_obj *params)
state->predictor = 1;
}
- obj = fz_dict_gets(params, "Columns");
- if (obj)
- state->columns = fz_to_int(obj);
-
- obj = fz_dict_gets(params, "Colors");
- if (obj)
- state->colors = fz_to_int(obj);
-
- obj = fz_dict_gets(params, "BitsPerComponent");
- if (obj)
- state->bpc = fz_to_int(obj);
-
state->stride = (state->bpc * state->colors * state->columns + 7) / 8;
state->bpp = (state->bpc * state->colors + 7) / 8;