Fix #33210: Diffuse Pass in scale node leads to problems
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 17 Nov 2012 13:38:39 +0000 (13:38 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 17 Nov 2012 13:38:39 +0000 (13:38 +0000)
Was own mistake in render layers interpolation changes.

source/blender/blenlib/intern/math_interp.c

index 59a1c1f649c65518b2c5181da40aac9d8f1a65ca..5a9e8244a469832543abec6f01034a8210fa9191 100644 (file)
@@ -134,12 +134,12 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
                        w = wx * wy[m + 1];
 
                        if (float_output) {
-                               const float *float_data = float_buffer + width * y1 * 4 + 4 * x1;
+                               const float *float_data = float_buffer + width * y1 * components + components * x1;
 
                                vector_from_float(float_data, data, components);
                        }
                        else {
-                               const unsigned char *byte_data = byte_buffer + width * y1 * 4 + 4 * x1;
+                               const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
 
                                vector_from_byte(byte_data, data, components);
                        }
@@ -173,12 +173,12 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
                                float data[4];
 
                                if (float_output) {
-                                       const float *float_data = float_buffer + width * y1 * 4 + 4 * x1;
+                                       const float *float_data = float_buffer + width * y1 * components + components * x1;
 
                                        vector_from_float(float_data, data, components);
                                }
                                else {
-                                       const unsigned char *byte_data = byte_buffer + width * y1 * 4 + 4 * x1;
+                                       const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
 
                                        vector_from_byte(byte_data, data, components);
                                }
@@ -270,16 +270,16 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
 
                /* sample including outside of edges of image */
                if (x1 < 0 || y1 < 0) row1 = empty;
-               else row1 = float_buffer + width * y1 * 4 + 4 * x1;
+               else row1 = float_buffer + width * y1 * components + components * x1;
 
                if (x1 < 0 || y2 > height - 1) row2 = empty;
-               else row2 = float_buffer + width * y2 * 4 + 4 * x1;
+               else row2 = float_buffer + width * y2 * components + components * x1;
 
                if (x2 > width - 1 || y1 < 0) row3 = empty;
-               else row3 = float_buffer + width * y1 * 4 + 4 * x2;
+               else row3 = float_buffer + width * y1 * components + components * x2;
 
                if (x2 > width - 1 || y2 > height - 1) row4 = empty;
-               else row4 = float_buffer + width * y2 * 4 + 4 * x2;
+               else row4 = float_buffer + width * y2 * components + components * x2;
 
                a = u - floorf(u);
                b = v - floorf(v);
@@ -306,16 +306,16 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
 
                /* sample including outside of edges of image */
                if (x1 < 0 || y1 < 0) row1 = empty;
-               else row1 = byte_buffer + width * y1 * 4 + 4 * x1;
+               else row1 = byte_buffer + width * y1 * components + components * x1;
 
                if (x1 < 0 || y2 > height - 1) row2 = empty;
-               else row2 = byte_buffer + width * y2 * 4 + 4 * x1;
+               else row2 = byte_buffer + width * y2 * components + components * x1;
 
                if (x2 > width - 1 || y1 < 0) row3 = empty;
-               else row3 = byte_buffer + width * y1 * 4 + 4 * x2;
+               else row3 = byte_buffer + width * y1 * components + components * x2;
 
                if (x2 > width - 1 || y2 > height - 1) row4 = empty;
-               else row4 = byte_buffer + width * y2 * 4 + 4 * x2;
+               else row4 = byte_buffer + width * y2 * components + components * x2;
 
                a = u - floorf(u);
                b = v - floorf(v);