From 225f68c324a3417fa3afb745c0e0f7e404737634 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 24 Feb 2015 00:36:33 +0500 Subject: Fix interpolation functions ignoring number of components when doing early output --- source/blender/blenlib/intern/math_interp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/blenlib/intern/math_interp.c') 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; } -- cgit v1.2.3