[MOVED FROM BAD 28/29] shapewipe: Scale mask alpha values by the source alpha values
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 10 Feb 2010 09:50:49 +0000 (10:50 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 12 Feb 2010 10:12:35 +0000 (11:12 +0100)
gst/shapewipe/gstshapewipe.c

index 944ff6b..b74b1c4 100644 (file)
@@ -808,14 +808,15 @@ gst_shape_wipe_blend_ayuv_##depth (GstShapeWipe * self, GstBuffer * inbuf, \
         output[2] = 0x80;       /* U */ \
         output[3] = 0x80;       /* V */ \
       } else if (in >= high_i) { \
-        output[0] = 0xff;       /* A */ \
+        output[0] = input[0];   /* A */ \
         output[1] = input[1];   /* Y */ \
         output[2] = input[2];   /* U */ \
         output[3] = input[3];   /* V */ \
       } else { \
         guint32 val; \
         /* Note: This will never overflow or be larger than 255! */ \
-        val = ((((in - low_i) << 16) + round_i) / (high_i - low_i)) >> 8; \
+        val = (((in - low_i) << 16) + round_i) / (high_i - low_i); \
+        val = (val * input[0] + 32768) >> 16; \
         \
         output[0] = val;        /* A */ \
         output[1] = input[1];   /* Y */ \
@@ -876,14 +877,15 @@ gst_shape_wipe_blend_##name##_##depth (GstShapeWipe * self, GstBuffer * inbuf, \
         output[g] = 0x00;       /* G */ \
         output[b] = 0x00;       /* B */ \
       } else if (in >= high_i) { \
-        output[a] = 0xff;       /* A */ \
+        output[a] = input[a];   /* A */ \
         output[r] = input[r];   /* R */ \
         output[g] = input[g];   /* G */ \
         output[b] = input[b];   /* B */ \
       } else { \
         guint32 val; \
         /* Note: This will never overflow or be larger than 255! */ \
-        val = ((((in - low_i) << 16) + round_i) / (high_i - low_i)) >> 8; \
+        val = (((in - low_i) << 16) + round_i) / (high_i - low_i); \
+        val = (val * input[a] + 32768) >> 16; \
         \
         output[a] = val;        /* A */ \
         output[r] = input[r];   /* R */ \