summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-03-25 14:16:25 +0200
committerStefan Kost <ensonic@users.sf.net>2009-03-25 14:40:42 +0200
commit492b8861c4ba2e04ca263d66d1e2cfaeee66b296 (patch)
tree05c7167ee6e931627823c81ecdac665f01982d10
parent0267e79778dade2978fab80bbf2f190ae8a624fa (diff)
xvimagesink: scale the colorkey components in case of 16bit visuals
Use a default that won't be scales to 0,0,0
-rw-r--r--sys/xvimage/xvimagesink.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index 785a97cc7..818ffd2b1 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -1427,11 +1427,14 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
cr = (xvimagesink->colorkey >> 16);
cg = (xvimagesink->colorkey >> 8) & 0xFF;
cb = (xvimagesink->colorkey) & 0xFF;
- if (bits == 16)
+ if (bits == 16) { /* RGB 565 */
+ cr >>= 3;
+ cg >>= 2;
+ cb >>= 3;
ckey = (cr << 11) | (cg << 5) | cb;
- else if (bits == 24 || bits == 32)
+ } else if (bits == 24 || bits == 32) { /* RGB 888 / ARGB 8888 */
ckey = (cr << 16) | (cg << 8) | cb;
- else
+ } else
set_attr = FALSE;
if (set_attr) {
@@ -3264,7 +3267,11 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink)
xvimagesink->handle_expose = TRUE;
xvimagesink->autopaint_colorkey = TRUE;
- xvimagesink->colorkey = (1 << 16) | (2 << 8) | 3;
+ /* on 16bit displays this becomes r,g,b = 1,2,3
+ * on 24bit displays this becomes r,g,b = 8,8,16
+ * as a port atom value
+ */
+ xvimagesink->colorkey = (8 << 16) | (8 << 8) | 16;
xvimagesink->draw_borders = TRUE;
}