Fixes for swig
[melted] / src / modules / plus / transition_affine.c
index e04f9ff..9c3883c 100644 (file)
@@ -517,7 +517,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        mlt_frame_get_image( a_frame, image, format, width, height, 1 );
 
        // Calculate the region now
-       composite_calculate( &result, this, a_frame, ( float )position / ( out - in + 1 ) );
+       composite_calculate( &result, this, a_frame, ( float )( position - in ) / ( out - in + 1 ) );
 
        // Fetch the b frame image
        result.w = ( int )( result.w * *width / result.nw );
@@ -620,14 +620,14 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                                {
                                        if ( alpha == NULL )
                                        {
-                                               dx -= dx & 1;
+                                               dx += dx & 1;
                                                *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) );
                                                *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 );
                                        }
                                        else
                                        {
-                                               dx -= dx & 1;
                                                mix = ( float )*( alpha + dy * b_width + dx ) / 255.0;
+                                               dx += dx & 1;
                                                *p ++ = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) );
                                                *p ++ = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 );
                                        }