diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-23 22:36:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-23 22:36:33 +0300 |
commit | 225f68c324a3417fa3afb745c0e0f7e404737634 (patch) | |
tree | e32be7a23955fac66a062dbf6fedcf5ccb5def10 /source/blender/blenlib/intern/math_interp.c | |
parent | 2081fd1d7de40f7b3e1a529f5b450ed508fe9257 (diff) |
Fix interpolation functions ignoring number of components when doing early output
Diffstat (limited to 'source/blender/blenlib/intern/math_interp.c')
-rw-r--r-- | source/blender/blenlib/intern/math_interp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index a0c47be8d48..67850463fe2 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -111,10 +111,12 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl /* sample area entirely outside image? */ if (ceil(u) < 0 || floor(u) > width - 1 || ceil(v) < 0 || floor(v) > height - 1) { - if (float_output) - float_output[0] = float_output[1] = float_output[2] = float_output[3] = 0.0f; - if (byte_output) - byte_output[0] = byte_output[1] = byte_output[2] = byte_output[3] = 0; + if (float_output) { + fill_vn_fl(float_output, components, 0.0f); + } + if (byte_output) { + fill_vn_uchar(byte_output, components, 0); + } return; } @@ -279,7 +281,7 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f /* sample area entirely outside image? */ if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) { - float_output[0] = float_output[1] = float_output[2] = float_output[3] = 0.0f; + fill_vn_fl(float_output, components, 0.0f); return; } @@ -321,7 +323,7 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f /* sample area entirely outside image? */ if (x2 < 0 || x1 > width - 1 || y2 < 0 || y1 > height - 1) { - byte_output[0] = byte_output[1] = byte_output[2] = byte_output[3] = 0; + fill_vn_uchar(byte_output, components, 0); return; } |