Mercurial > mplayer.hg
comparison libvo/vo_xmga.c @ 10988:c2bff70784d5
user settable colorkey
author | alex |
---|---|
date | Fri, 03 Oct 2003 18:13:45 +0000 |
parents | 07870312c054 |
children | 85e503ddf65f |
comparison
equal
deleted
inserted
replaced
10987:d5bea962297a | 10988:c2bff70784d5 |
---|---|
60 | 60 |
61 static XGCValues wGCV; | 61 static XGCValues wGCV; |
62 | 62 |
63 static uint32_t mDepth; | 63 static uint32_t mDepth; |
64 static XWindowAttributes attribs; | 64 static XWindowAttributes attribs; |
65 static uint32_t fgColor; | 65 static int colorkey; |
66 | 66 |
67 static uint32_t mvHeight; | 67 static uint32_t mvHeight; |
68 static uint32_t mvWidth; | 68 static uint32_t mvWidth; |
69 | 69 |
70 static Window mRoot; | 70 static Window mRoot; |
79 | 79 |
80 static void mDrawColorKey( void ) | 80 static void mDrawColorKey( void ) |
81 { | 81 { |
82 XSetBackground( mDisplay,vo_gc,0 ); | 82 XSetBackground( mDisplay,vo_gc,0 ); |
83 XClearWindow( mDisplay,vo_window ); | 83 XClearWindow( mDisplay,vo_window ); |
84 XSetForeground( mDisplay,vo_gc,fgColor ); | 84 XSetForeground( mDisplay,vo_gc,colorkey ); |
85 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) ); | 85 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) ); |
86 XFlush( mDisplay ); | 86 XFlush( mDisplay ); |
87 } | 87 } |
88 | 88 |
89 static void check_events(void) | 89 static void check_events(void) |
110 static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) | 110 static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
111 { | 111 { |
112 char * mTitle=(title == NULL) ? "XMGA render" : title; | 112 char * mTitle=(title == NULL) ? "XMGA render" : title; |
113 XVisualInfo vinfo; | 113 XVisualInfo vinfo; |
114 unsigned long xswamask; | 114 unsigned long xswamask; |
115 int r, g, b; | |
115 | 116 |
116 if(mga_init(width,height,format)) return -1; // ioctl errors? | 117 if(mga_init(width,height,format)) return -1; // ioctl errors? |
117 | 118 |
118 aspect_save_orig(width,height); | 119 aspect_save_orig(width,height); |
119 aspect_save_prescale(d_width,d_height); | 120 aspect_save_prescale(d_width,d_height); |
127 vo_dy=( vo_screenheight - d_height ) / 2; | 128 vo_dy=( vo_screenheight - d_height ) / 2; |
128 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); | 129 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); |
129 vo_dwidth=d_width; vo_dheight=d_height; | 130 vo_dwidth=d_width; vo_dheight=d_height; |
130 vo_mouse_autohide=1; | 131 vo_mouse_autohide=1; |
131 | 132 |
133 r = (vo_colorkey & 0x00ff0000) >> 16; | |
134 g = (vo_colorkey & 0x0000ff00) >> 8; | |
135 b = vo_colorkey & 0x000000ff; | |
132 switch ( vo_depthonscreen ) | 136 switch ( vo_depthonscreen ) |
133 { | 137 { |
134 case 32: | 138 case 32: colorkey = vo_colorkey; break; |
135 case 24: fgColor=0x00ff00ffL; break; | 139 case 24: colorkey = vo_colorkey & 0x00ffffff; break; |
136 case 16: fgColor=0xf81fL; break; | 140 case 16: colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); break; |
137 case 15: fgColor=0x7c1fL; break; | 141 case 15: colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); break; |
138 default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1; | 142 default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1; |
139 } | 143 } |
144 mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey); | |
140 | 145 |
141 inited=1; | 146 inited=1; |
142 | 147 |
143 aspect(&d_width,&d_height,A_NOZOOM); | 148 aspect(&d_width,&d_height,A_NOZOOM); |
144 | 149 |
206 if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; } | 211 if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; } |
207 | 212 |
208 panscan_calc(); | 213 panscan_calc(); |
209 | 214 |
210 mga_vid_config.colkey_on=1; | 215 mga_vid_config.colkey_on=1; |
211 mga_vid_config.colkey_red=255; | 216 mga_vid_config.colkey_red=r; |
212 mga_vid_config.colkey_green=0; | 217 mga_vid_config.colkey_green=g; |
213 mga_vid_config.colkey_blue=255; | 218 mga_vid_config.colkey_blue=b; |
214 | 219 |
215 set_window(); // set up mga_vid_config.dest_width etc | 220 set_window(); // set up mga_vid_config.dest_width etc |
216 | 221 |
217 saver_off(mDisplay); | 222 saver_off(mDisplay); |
218 | 223 |