From 492b8861c4ba2e04ca263d66d1e2cfaeee66b296 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Wed, 25 Mar 2009 14:16:25 +0200 Subject: [PATCH] xvimagesink: scale the colorkey components in case of 16bit visuals Use a default that won't be scales to 0,0,0 --- sys/xvimage/xvimagesink.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 785a97cc7f..818ffd2b1e 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; }