diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-26 14:29:22 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-27 15:11:37 +0200 |
commit | cb85c97aba355ebe53849743611aaf78a483d24e (patch) | |
tree | c70a14dc542a415d1a160d8906a30f51dd1fbb74 /source | |
parent | b3d004e42d14d99ae4c4b53f1b43b7fae0b50649 (diff) | |
download | mupdf-cb85c97aba355ebe53849743611aaf78a483d24e.tar.xz |
Remove unused fz_function debug printing.
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-function.c | 222 |
1 files changed, 0 insertions, 222 deletions
diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c index 5d57bbb4..2cb83045 100644 --- a/source/pdf/pdf-function.c +++ b/source/pdf/pdf-function.c @@ -1381,227 +1381,6 @@ pdf_eval_function(fz_context *ctx, fz_function *func_, const float *in, float *o } } -/* - * Debugging prints - */ - -static void -pdf_debug_indent(fz_context *ctx, fz_output *out, char *prefix, int level, char *suffix) -{ - int i; - - fz_write_string(ctx, out, prefix); - - for (i = 0; i < level; i++) - fz_write_byte(ctx, out, '\t'); - - fz_write_string(ctx, out, suffix); -} - -static void -pdf_debug_ps_func_code(fz_context *ctx, fz_output *out, psobj *funccode, psobj *code, int level) -{ - int eof, wasop; - - pdf_debug_indent(ctx, out, "", level, "{"); - - /* Print empty blocks as { }, instead of separating braces on different lines. */ - if (code->type == PS_OPERATOR && code->u.op == PS_OP_RETURN) - { - printf(" } "); - return; - } - - pdf_debug_indent(ctx, out, "\n", ++level, ""); - - eof = 0; - wasop = 0; - while (!eof) - { - switch (code->type) - { - case PS_INT: - if (wasop) - pdf_debug_indent(ctx, out, "\n", level, ""); - - printf("%d ", code->u.i); - wasop = 0; - code++; - break; - - case PS_REAL: - if (wasop) - pdf_debug_indent(ctx, out, "\n", level, ""); - - printf("%g ", code->u.f); - wasop = 0; - code++; - break; - - case PS_OPERATOR: - if (code->u.op == PS_OP_RETURN) - { - printf("\n"); - eof = 1; - } - else if (code->u.op == PS_OP_IF) - { - printf("\n"); - pdf_debug_ps_func_code(ctx, out, funccode, &funccode[(code + 2)->u.block], level); - - printf("%s", ps_op_names[code->u.op]); - code = &funccode[(code + 3)->u.block]; - if (code->type != PS_OPERATOR || code->u.op != PS_OP_RETURN) - pdf_debug_indent(ctx, out, "\n", level, ""); - - wasop = 0; - } - else if (code->u.op == PS_OP_IFELSE) - { - printf("\n"); - pdf_debug_ps_func_code(ctx, out, funccode, &funccode[(code + 2)->u.block], level); - - printf("\n"); - pdf_debug_ps_func_code(ctx, out, funccode, &funccode[(code + 1)->u.block], level); - - printf("%s", ps_op_names[code->u.op]); - code = &funccode[(code + 3)->u.block]; - if (code->type != PS_OPERATOR || code->u.op != PS_OP_RETURN) - pdf_debug_indent(ctx, out, "\n", level, ""); - - wasop = 0; - } - else - { - printf("%s ", ps_op_names[code->u.op]); - code++; - wasop = 1; - } - break; - } - } - - pdf_debug_indent(ctx, out, "", --level, "} "); -} - -static void -pdf_debug_function_imp(fz_context *ctx, fz_output *out, fz_function *func_, int level) -{ - int i; - pdf_function *func = (pdf_function *)func_; - - pdf_debug_indent(ctx, out, "", level, "function {\n"); - - pdf_debug_indent(ctx, out, "", ++level, ""); - switch (func->type) - { - case SAMPLE: - printf("sampled"); - break; - case EXPONENTIAL: - printf("exponential"); - break; - case STITCHING: - printf("stitching"); - break; - case POSTSCRIPT: - printf("postscript"); - break; - } - - pdf_debug_indent(ctx, out, "\n", level, ""); - fz_write_printf(ctx, out, "%d input -> %d output\n", func->base.m, func->base.n); - - pdf_debug_indent(ctx, out, "", level, "domain "); - for (i = 0; i < func->base.m; i++) - fz_write_printf(ctx, out, "%g %g ", func->domain[i][0], func->domain[i][1]); - fz_write_printf(ctx, out, "\n"); - - if (func->has_range) - { - pdf_debug_indent(ctx, out, "", level, "range "); - for (i = 0; i < func->base.n; i++) - fz_write_printf(ctx, out, "%g %g ", func->range[i][0], func->range[i][1]); - fz_write_printf(ctx, out, "\n"); - } - - switch (func->type) - { - case SAMPLE: - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "bps: %d\n", func->u.sa.bps); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "size: [ "); - for (i = 0; i < func->base.m; i++) - fz_write_printf(ctx, out, "%d ", func->u.sa.size[i]); - fz_write_printf(ctx, out, "]\n"); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "encode: [ "); - for (i = 0; i < func->base.m; i++) - fz_write_printf(ctx, out, "%g %g ", func->u.sa.encode[i][0], func->u.sa.encode[i][1]); - fz_write_printf(ctx, out, "]\n"); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "decode: [ "); - for (i = 0; i < func->base.m; i++) - fz_write_printf(ctx, out, "%g %g ", func->u.sa.decode[i][0], func->u.sa.decode[i][1]); - fz_write_printf(ctx, out, "]\n"); - break; - - case EXPONENTIAL: - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "n: %g\n", func->u.e.n); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "c0: [ "); - for (i = 0; i < func->base.n; i++) - fz_write_printf(ctx, out, "%g ", func->u.e.c0[i]); - fz_write_printf(ctx, out, "]\n"); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "c1: [ "); - for (i = 0; i < func->base.n; i++) - fz_write_printf(ctx, out, "%g ", func->u.e.c1[i]); - fz_write_printf(ctx, out, "]\n"); - break; - - case STITCHING: - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "%d functions\n", func->u.st.k); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "bounds: [ "); - for (i = 0; i < func->u.st.k - 1; i++) - fz_write_printf(ctx, out, "%g ", func->u.st.bounds[i]); - fz_write_printf(ctx, out, "]\n"); - - pdf_debug_indent(ctx, out, "", level, ""); - fz_write_printf(ctx, out, "encode: [ "); - for (i = 0; i < func->u.st.k * 2; i++) - fz_write_printf(ctx, out, "%g ", func->u.st.encode[i]); - fz_write_printf(ctx, out, "]\n"); - - for (i = 0; i < func->u.st.k; i++) - pdf_debug_function_imp(ctx, out, func->u.st.funcs[i], level); - break; - - case POSTSCRIPT: - pdf_debug_ps_func_code(ctx, out, func->u.p.code, func->u.p.code, level); - fz_write_printf(ctx, out, "\n"); - break; - } - - pdf_debug_indent(ctx, out, "", --level, "}\n"); -} - -void -pdf_print_function(fz_context *ctx, fz_output *out, fz_function *func) -{ - pdf_debug_function_imp(ctx, out, func, 0); -} - fz_function * pdf_load_function(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int in, int out) { @@ -1619,7 +1398,6 @@ pdf_load_function(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int in, int FZ_INIT_STORABLE(&func->base, 1, pdf_drop_function_imp); func->base.size = sizeof(*func); func->base.evaluate = pdf_eval_function; - func->base.print = pdf_print_function; obj = pdf_dict_get(ctx, dict, PDF_NAME_FunctionType); func->type = pdf_to_int(ctx, obj); |