diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-06-19 15:29:44 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2013-06-20 16:45:35 +0200 |
commit | 0a927854a10e1e6b9770a81e2e1d9f3093631757 (patch) | |
tree | 3d65d820d9fdba2d0d394d99c36290c851b78ca0 /source/fitz/function.c | |
parent | 1ae8f19179c5f0f8c6352b3c7855465325d5449a (diff) | |
download | mupdf-0a927854a10e1e6b9770a81e2e1d9f3093631757.tar.xz |
Rearrange source files.
Diffstat (limited to 'source/fitz/function.c')
-rw-r--r-- | source/fitz/function.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source/fitz/function.c b/source/fitz/function.c new file mode 100644 index 00000000..b5ba4815 --- /dev/null +++ b/source/fitz/function.c @@ -0,0 +1,48 @@ +#include "mupdf/fitz.h" + +void +fz_eval_function(fz_context *ctx, fz_function *func, float *in_, int inlen, float *out_, int outlen) +{ + float fakein[FZ_FN_MAXM]; + float fakeout[FZ_FN_MAXN]; + float *in = in_; + float *out = out_; + + if (inlen < func->m) + { + in = fakein; + memset(in, 0, sizeof(float) * func->m); + memcpy(in, in_, sizeof(float) * inlen); + } + + if (outlen < func->n) + { + out = fakeout; + memset(out, 0, sizeof(float) * func->n); + } + else + memset(out, 0, sizeof(float) * outlen); + + func->evaluate(ctx, func, in, out); + + if (outlen < func->n) + memcpy(out_, out, sizeof(float) * outlen); +} + +fz_function * +fz_keep_function(fz_context *ctx, fz_function *func) +{ + return (fz_function *)fz_keep_storable(ctx, &func->storable); +} + +void +fz_drop_function(fz_context *ctx, fz_function *func) +{ + fz_drop_storable(ctx, &func->storable); +} + +unsigned int +fz_function_size(fz_function *func) +{ + return (func ? func->size : 0); +} |