summaryrefslogtreecommitdiff
path: root/gst/shapewipe/gstshapewipe.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-02-10 10:50:49 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-02-10 10:50:49 +0100
commitdc551ed30fc494597503b7ef99a82cab2918e368 (patch)
tree89af1c3ece3aba2ce5a025676bd53b1f1fd40f69 /gst/shapewipe/gstshapewipe.c
parent6ef01b3c59acf08703d90acbf2a2c506590c3029 (diff)
shapewipe: Scale mask alpha values by the source alpha values
Diffstat (limited to 'gst/shapewipe/gstshapewipe.c')
-rw-r--r--gst/shapewipe/gstshapewipe.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c
index 944ff6bdc..b74b1c44b 100644
--- a/gst/shapewipe/gstshapewipe.c
+++ b/gst/shapewipe/gstshapewipe.c
@@ -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 */ \