diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-02-17 16:55:04 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-02-17 16:55:04 +0100 |
commit | 954c65a0acf2cef0291090afa2e699aa0e32da27 (patch) | |
tree | a3ed7efb9b2dbffc050c5917fe25db0af339fe6e /source/fitz/function.c | |
parent | 70908de17a69aaeb9ea9a2ad15d45bda12671bdf (diff) | |
download | mupdf-954c65a0acf2cef0291090afa2e699aa0e32da27.tar.xz |
Tweak fz_eval_function fakein/out buffer copying.
Diffstat (limited to 'source/fitz/function.c')
-rw-r--r-- | source/fitz/function.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source/fitz/function.c b/source/fitz/function.c index 7ebdb912..2623ff3d 100644 --- a/source/fitz/function.c +++ b/source/fitz/function.c @@ -1,32 +1,35 @@ #include "mupdf/fitz.h" void -fz_eval_function(fz_context *ctx, fz_function *func, const float *in_, int inlen, float *out_, int outlen) +fz_eval_function(fz_context *ctx, fz_function *func, const float *in, int inlen, float *out, int outlen) { float fakein[FZ_FN_MAXM]; float fakeout[FZ_FN_MAXN]; - const float *in = in_; - float *out = out_; + int i; if (inlen < func->m) { + for (i = 0; i < func->m; ++i) + fakein[i] = in[i]; + for (; i < inlen; ++i) + fakein[i] = 0; in = fakein; - memset(fakein, 0, sizeof(float) * func->m); - memcpy(fakein, in_, sizeof(float) * inlen); } if (outlen < func->n) { - out = fakeout; - memset(out, 0, sizeof(float) * func->n); + func->evaluate(ctx, func, in, fakeout); + for (i = 0; i < func->n; ++i) + out[i] = fakeout[i]; + for (; i < outlen; ++i) + out[i] = 0; } else - memset(out, 0, sizeof(float) * outlen); - - func->evaluate(ctx, func, in, out); - - if (outlen < func->n) - memcpy(out_, out, sizeof(float) * outlen); + { + func->evaluate(ctx, func, in, out); + for (i = func->n; i < outlen; ++i) + out[i] = 0; + } } fz_function * |