comparison gui/wm/ws.c @ 35676:b0ad675bd3b7

Cosmetic: Rename DepthOnScreen ScreenDepth.
author ib
date Thu, 17 Jan 2013 17:35:32 +0000
parents 5c2f331d306a
children 539f3d45dcf5
comparison
equal deleted inserted replaced
35675:9e2183017f1f 35676:b0ad675bd3b7
85 85
86 Display *wsDisplay; 86 Display *wsDisplay;
87 static int wsScreen; 87 static int wsScreen;
88 static Window wsRootWin; 88 static Window wsRootWin;
89 89
90 int wsDepthOnScreen; 90 int wsScreenDepth;
91 static int wsRedMask; 91 static int wsRedMask;
92 static int wsGreenMask; 92 static int wsGreenMask;
93 static int wsBlueMask; 93 static int wsBlueMask;
94 static int wsOutMask; 94 static int wsOutMask;
95 static int wsNonNativeOrder; 95 static int wsNonNativeOrder;
163 win->Width = wsMaxX; 163 win->Width = wsMaxX;
164 win->Height = wsMaxY; 164 win->Height = wsMaxY;
165 } 165 }
166 } 166 }
167 167
168 static int wsGetDepthOnScreen(void) 168 static int wsGetScreenDepth(void)
169 { 169 {
170 int depth; 170 int depth;
171 XImage *mXImage; 171 XImage *mXImage;
172 Visual *visual; 172 Visual *visual;
173 173
174 if ((depth = vo_find_depth_from_visuals(wsDisplay, wsScreen, &visual)) > 0) { 174 if ((depth = vo_find_depth_from_visuals(wsDisplay, wsScreen, &visual)) > 0) {
175 mXImage = XCreateImage(wsDisplay, visual, depth, ZPixmap, 0, NULL, 175 mXImage = XCreateImage(wsDisplay, visual, depth, ZPixmap, 0, NULL,
176 1, 1, 32, 0); 176 1, 1, 32, 0);
177 wsDepthOnScreen = mXImage->bits_per_pixel; 177 wsScreenDepth = mXImage->bits_per_pixel;
178 wsRedMask = mXImage->red_mask; 178 wsRedMask = mXImage->red_mask;
179 wsGreenMask = mXImage->green_mask; 179 wsGreenMask = mXImage->green_mask;
180 wsBlueMask = mXImage->blue_mask; 180 wsBlueMask = mXImage->blue_mask;
181 #if HAVE_BIGENDIAN 181 #if HAVE_BIGENDIAN
182 wsNonNativeOrder = mXImage->byte_order == LSBFirst; 182 wsNonNativeOrder = mXImage->byte_order == LSBFirst;
197 bpp = mXImage->bits_per_pixel; 197 bpp = mXImage->bits_per_pixel;
198 198
199 if ((ibpp + 7) / 8 != (bpp + 7) / 8) 199 if ((ibpp + 7) / 8 != (bpp + 7) / 8)
200 ibpp = bpp; 200 ibpp = bpp;
201 201
202 wsDepthOnScreen = ibpp; 202 wsScreenDepth = ibpp;
203 wsRedMask = mXImage->red_mask; 203 wsRedMask = mXImage->red_mask;
204 wsGreenMask = mXImage->green_mask; 204 wsGreenMask = mXImage->green_mask;
205 wsBlueMask = mXImage->blue_mask; 205 wsBlueMask = mXImage->blue_mask;
206 XDestroyImage(mXImage); 206 XDestroyImage(mXImage);
207 } 207 }
208 208
209 return wsDepthOnScreen; 209 return wsScreenDepth;
210 } 210 }
211 211
212 static int wsGetOutMask(void) 212 static int wsGetOutMask(void)
213 { 213 {
214 if ((wsDepthOnScreen == 32) && (wsRedMask == 0xff0000) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0x0000ff)) 214 if ((wsScreenDepth == 32) && (wsRedMask == 0xff0000) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0x0000ff))
215 return wsRGB32; 215 return wsRGB32;
216 216
217 if ((wsDepthOnScreen == 32) && (wsRedMask == 0x0000ff) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0xff0000)) 217 if ((wsScreenDepth == 32) && (wsRedMask == 0x0000ff) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0xff0000))
218 return wsBGR32; 218 return wsBGR32;
219 219
220 if ((wsDepthOnScreen == 24) && (wsRedMask == 0xff0000) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0x0000ff)) 220 if ((wsScreenDepth == 24) && (wsRedMask == 0xff0000) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0x0000ff))
221 return wsRGB24; 221 return wsRGB24;
222 222
223 if ((wsDepthOnScreen == 24) && (wsRedMask == 0x0000ff) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0xff0000)) 223 if ((wsScreenDepth == 24) && (wsRedMask == 0x0000ff) && (wsGreenMask == 0x00ff00) && (wsBlueMask == 0xff0000))
224 return wsBGR24; 224 return wsBGR24;
225 225
226 if ((wsDepthOnScreen == 16) && (wsRedMask == 0xf800) && (wsGreenMask == 0x7e0) && (wsBlueMask == 0x1f)) 226 if ((wsScreenDepth == 16) && (wsRedMask == 0xf800) && (wsGreenMask == 0x7e0) && (wsBlueMask == 0x1f))
227 return wsRGB16; 227 return wsRGB16;
228 228
229 if ((wsDepthOnScreen == 16) && (wsRedMask == 0x1f) && (wsGreenMask == 0x7e0) && (wsBlueMask == 0xf800)) 229 if ((wsScreenDepth == 16) && (wsRedMask == 0x1f) && (wsGreenMask == 0x7e0) && (wsBlueMask == 0xf800))
230 return wsBGR16; 230 return wsBGR16;
231 231
232 if ((wsDepthOnScreen == 15) && (wsRedMask == 0x7c00) && (wsGreenMask == 0x3e0) && (wsBlueMask == 0x1f)) 232 if ((wsScreenDepth == 15) && (wsRedMask == 0x7c00) && (wsGreenMask == 0x3e0) && (wsBlueMask == 0x1f))
233 return wsRGB15; 233 return wsRGB15;
234 234
235 if ((wsDepthOnScreen == 15) && (wsRedMask == 0x1f) && (wsGreenMask == 0x3e0) && (wsBlueMask == 0x7c00)) 235 if ((wsScreenDepth == 15) && (wsRedMask == 0x1f) && (wsGreenMask == 0x3e0) && (wsBlueMask == 0x7c00))
236 return wsBGR15; 236 return wsBGR15;
237 237
238 return 0; 238 return 0;
239 } 239 }
240 240
307 wsMaxY = DisplayHeight(wsDisplay, wsScreen); 307 wsMaxY = DisplayHeight(wsDisplay, wsScreen);
308 } 308 }
309 309
310 wsUpdateXineramaInfo(NULL); 310 wsUpdateXineramaInfo(NULL);
311 311
312 wsGetDepthOnScreen(); 312 wsGetScreenDepth();
313 313
314 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] Screen depth: %d\n", wsDepthOnScreen); 314 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] Screen depth: %d\n", wsScreenDepth);
315 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] size: %dx%d\n", wsMaxX, wsMaxY); 315 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] size: %dx%d\n", wsMaxX, wsMaxY);
316 316
317 #ifdef CONFIG_XINERAMA 317 #ifdef CONFIG_XINERAMA
318 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] origin: +%d+%d\n", wsOrgX, wsOrgY); 318 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[ws] origin: +%d+%d\n", wsOrgX, wsOrgY);
319 #endif 319 #endif
1385 } else 1385 } else
1386 #endif 1386 #endif
1387 { 1387 {
1388 win->xImage = XCreateImage(wsDisplay, win->VisualInfo.visual, win->VisualInfo.depth, 1388 win->xImage = XCreateImage(wsDisplay, win->VisualInfo.visual, win->VisualInfo.depth,
1389 ZPixmap, 0, 0, Width, Height, 1389 ZPixmap, 0, 0, Width, Height,
1390 (wsDepthOnScreen == 3) ? 32 : wsDepthOnScreen, 1390 (wsScreenDepth == 3) ? 32 : wsScreenDepth,
1391 0); 1391 0);
1392 1392
1393 if ((win->xImage->data = malloc(win->xImage->bytes_per_line * win->xImage->height)) == NULL) { 1393 if ((win->xImage->data = malloc(win->xImage->bytes_per_line * win->xImage->height)) == NULL) {
1394 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_NotEnoughMemoryDrawBuffer); 1394 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_WS_NotEnoughMemoryDrawBuffer);
1395 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); 1395 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);