commit yesterday broke scaling in the sequencer (dumb mistake)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 20 Nov 2008 00:34:24 +0000 (00:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 20 Nov 2008 00:34:24 +0000 (00:34 +0000)
also changed 3 if's into a switch statement for selecting the interpolation.

source/blender/imbuf/intern/imageprocess.c
source/blender/src/seqeffects.c

index f25872538cfbab612efeebe5dc809eeef0110a8e..fe7e26eac2b427c15ab18811783d76e6b49f5c34 100644 (file)
@@ -80,16 +80,16 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
                }
        }
 }
-static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char *outI, float *outF, int x, int y)
+static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
 
 {
        int offset = ibuf->x * y * 4 + 4*x;
        
        if (ibuf->rect)
-               outI= (unsigned char *)ibuf->rect + offset;
+               *outI= (unsigned char *)ibuf->rect + offset;
        
        if (ibuf->rect_float)
-               outF= (float *)ibuf->rect_float + offset;
+               *outF= (float *)ibuf->rect_float + offset;
 }
 
 /**************************************************************************
@@ -226,7 +226,7 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in
        
        if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
        
-       pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
+       pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
        
        bicubic_interpolation_color(in, outI, outF, u, v);
 }
@@ -309,7 +309,7 @@ void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, i
        
        if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
        
-       pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
+       pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
        
        bilinear_interpolation_color(in, outI, outF, u, v);
 }
@@ -370,7 +370,7 @@ void neareast_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, i
 
        if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
        
-       pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
+       pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
        
        neareast_interpolation_color(in, outI, outF, x, y);
-}
\ No newline at end of file
+}
index 05aff70dedfef19c79cd6f72d42973b7b7a99ee0..58554fbfebaddb2e3f68e2da06ac79f869f176e8 100644 (file)
@@ -2007,8 +2007,8 @@ static void do_transform(Sequence * seq,float facf0, int x, int y,
                tx = scale->xIni+(xo / 2.0f) + (scale->xFin-(xo / 2.0f) - scale->xIni+(xo / 2.0f)) * facf0;
                ty = scale->yIni+(yo / 2.0f) + (scale->yFin-(yo / 2.0f) - scale->yIni+(yo / 2.0f)) * facf0;
        }else{
-               tx = xo*(scale->xIni/100.0)+(xo / 2.0f) + (xo*(scale->xFin/100.0)-(xo / 2.0f) - xo*(scale->xIni/100.0)+(xo / 2.0f)) * facf0;
-               ty = yo*(scale->yIni/100.0)+(yo / 2.0f) + (yo*(scale->yFin/100.0)-(yo / 2.0f) - yo*(scale->yIni/100.0)+(yo / 2.0f)) * facf0;
+               tx = xo*(scale->xIni/100.0f)+(xo / 2.0f) + (xo*(scale->xFin/100.0f)-(xo / 2.0f) - xo*(scale->xIni/100.0f)+(xo / 2.0f)) * facf0;
+               ty = yo*(scale->yIni/100.0f)+(yo / 2.0f) + (yo*(scale->yFin/100.0f)-(yo / 2.0f) - yo*(scale->yIni/100.0f)+(yo / 2.0f)) * facf0;
        }
 
        //factor Rotate
@@ -2036,12 +2036,17 @@ static void do_transform(Sequence * seq,float facf0, int x, int y,
                        ys += (yo / 2.0f);
 
                        //interpolate
-                       if(scale->interpolation==0)
+                       switch(scale->interpolation) {
+                       case 0:
                                neareast_interpolation(ibuf1,out, xs,ys,xi,yi);
-                       if(scale->interpolation==1)
+                               break;
+                       case 1:
                                bilinear_interpolation(ibuf1,out, xs,ys,xi,yi);
-                       if(scale->interpolation==2)
+                               break;
+                       case 2:
                                bicubic_interpolation(ibuf1,out, xs,ys,xi,yi);
+                               break;
+                       }
                }
        }