comparison libvo/vo_gl.c @ 19580:dd2312f887a6

Cosmetics: reindent, remove tabs and break overlong lines.
author reimar
date Mon, 28 Aug 2006 20:38:31 +0000
parents c4f5738248ac
children 2c552f298f0d
comparison
equal deleted inserted replaced
19579:c4f5738248ac 19580:dd2312f887a6
18 #endif 18 #endif
19 #include "libass/ass.h" 19 #include "libass/ass.h"
20 20
21 static vo_info_t info = 21 static vo_info_t info =
22 { 22 {
23 "X11 (OpenGL)", 23 "X11 (OpenGL)",
24 "gl", 24 "gl",
25 "Arpad Gereoffy <arpi@esp-team.scene.hu>", 25 "Arpad Gereoffy <arpi@esp-team.scene.hu>",
26 "" 26 ""
27 }; 27 };
28 28
29 LIBVO_EXTERN(gl) 29 LIBVO_EXTERN(gl)
30 30
31 #ifdef GL_WIN32 31 #ifdef GL_WIN32
371 * allocate colors and (shared) memory 371 * allocate colors and (shared) memory
372 */ 372 */
373 static int 373 static int
374 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) 374 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
375 { 375 {
376 image_height = height; 376 image_height = height;
377 image_width = width; 377 image_width = width;
378 image_format = format; 378 image_format = format;
379 glFindFormat(format, NULL, &gl_texfmt, &gl_format, &gl_type); 379 glFindFormat(format, NULL, &gl_texfmt, &gl_format, &gl_type);
380 380
381 int_pause = 0; 381 int_pause = 0;
382 vo_flipped = !!(flags & VOFLAG_FLIPPING); 382 vo_flipped = !!(flags & VOFLAG_FLIPPING);
383 383
384 panscan_init(); 384 panscan_init();
385 aspect_save_orig(width,height); 385 aspect_save_orig(width,height);
386 aspect_save_prescale(d_width,d_height); 386 aspect_save_prescale(d_width,d_height);
387 update_xinerama_info(); 387 update_xinerama_info();
388 388
389 aspect(&d_width,&d_height,A_NOZOOM); 389 aspect(&d_width,&d_height,A_NOZOOM);
390 vo_dx = (int)(vo_screenwidth - d_width) / 2; 390 vo_dx = (int)(vo_screenwidth - d_width) / 2;
391 vo_dy = (int)(vo_screenheight - d_height) / 2; 391 vo_dy = (int)(vo_screenheight - d_height) / 2;
392 geometry(&vo_dx, &vo_dy, &d_width, &d_height, 392 geometry(&vo_dx, &vo_dy, &d_width, &d_height,
393 vo_screenwidth, vo_screenheight); 393 vo_screenwidth, vo_screenheight);
394 vo_dx += xinerama_x; 394 vo_dx += xinerama_x;
395 vo_dy += xinerama_y; 395 vo_dy += xinerama_y;
396 #ifdef HAVE_NEW_GUI 396 #ifdef HAVE_NEW_GUI
397 if (use_gui) { 397 if (use_gui) {
398 // GUI creates and manages window for us 398 // GUI creates and manages window for us
399 vo_dwidth = d_width; 399 vo_dwidth = d_width;
400 vo_dheight= d_height; 400 vo_dheight= d_height;
414 StructureNotifyMask | KeyPressMask | PointerMotionMask | 414 StructureNotifyMask | KeyPressMask | PointerMotionMask |
415 ButtonPressMask | ButtonReleaseMask | ExposureMask); 415 ButtonPressMask | ButtonReleaseMask | ExposureMask);
416 goto glconfig; 416 goto glconfig;
417 } 417 }
418 if ( vo_window == None ) { 418 if ( vo_window == None ) {
419 unsigned int fg, bg; 419 unsigned int fg, bg;
420 XSizeHints hint; 420 XSizeHints hint;
421 XVisualInfo *vinfo; 421 XVisualInfo *vinfo;
422 XEvent xev; 422 XEvent xev;
423 423
424 vo_fs = VO_FALSE; 424 vo_fs = VO_FALSE;
425 425
426 hint.x = vo_dx; 426 hint.x = vo_dx;
427 hint.y = vo_dy; 427 hint.y = vo_dy;
428 hint.width = d_width; 428 hint.width = d_width;
429 hint.height = d_height; 429 hint.height = d_height;
430 hint.flags = PPosition | PSize; 430 hint.flags = PPosition | PSize;
431 431
432 /* Get some colors */ 432 /* Get some colors */
433 433 bg = WhitePixel(mDisplay, mScreen);
434 bg = WhitePixel(mDisplay, mScreen); 434 fg = BlackPixel(mDisplay, mScreen);
435 fg = BlackPixel(mDisplay, mScreen); 435
436 436 /* Make the window */
437 /* Make the window */ 437 vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
438 438 if (vinfo == NULL)
439 vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); 439 {
440 if (vinfo == NULL) 440 mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
441 { 441 return -1;
442 mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n"); 442 }
443 return -1; 443
444 } 444 vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vinfo->visual,
445 445 hint.x, hint.y, hint.width, hint.height, vinfo->depth,
446 446 XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone));
447 447
448 vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vinfo->visual, hint.x, hint.y, hint.width, hint.height, 448 vo_x11_classhint( mDisplay,vo_window,"gl" );
449 vinfo->depth, XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone)); 449 vo_hidecursor(mDisplay,vo_window);
450 450
451 vo_x11_classhint( mDisplay,vo_window,"gl" ); 451 XSelectInput(mDisplay, vo_window, StructureNotifyMask);
452 vo_hidecursor(mDisplay,vo_window); 452 /* Tell other applications about this window */
453 453 XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
454 XSelectInput(mDisplay, vo_window, StructureNotifyMask); 454 /* Map window. */
455 /* Tell other applications about this window */ 455 XMapWindow(mDisplay, vo_window);
456 XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint); 456
457 /* Map window. */ 457 /* Wait for map. */
458 XMapWindow(mDisplay, vo_window); 458 do {
459 459 XNextEvent(mDisplay, &xev);
460 /* Wait for map. */ 460 } while (xev.type != MapNotify || xev.xmap.event != vo_window);
461 do 461
462 { 462 XSelectInput(mDisplay, vo_window, NoEventMask);
463 XNextEvent(mDisplay, &xev); 463
464 } 464 XSync(mDisplay, False);
465 while (xev.type != MapNotify || xev.xmap.event != vo_window); 465
466 466 vo_x11_selectinput_witherr(mDisplay, vo_window,
467 XSelectInput(mDisplay, vo_window, NoEventMask); 467 StructureNotifyMask | KeyPressMask | PointerMotionMask |
468 468 ButtonPressMask | ButtonReleaseMask | ExposureMask);
469 XSync(mDisplay, False); 469 }
470 470 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
471 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
472 | ButtonPressMask | ButtonReleaseMask | ExposureMask
473 );
474 }
475 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
476 471
477 vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height); 472 vo_x11_nofs_sizepos(vo_dx, vo_dy, d_width, d_height);
478 if (vo_fs ^ (flags & VOFLAG_FULLSCREEN)) 473 if (vo_fs ^ (flags & VOFLAG_FULLSCREEN))
479 vo_x11_fullscreen(); 474 vo_x11_fullscreen();
480 #endif 475 #endif
483 if (vo_config_count) 478 if (vo_config_count)
484 uninitGl(); 479 uninitGl();
485 setGlWindow(&gl_vinfo, &gl_context, vo_window); 480 setGlWindow(&gl_vinfo, &gl_context, vo_window);
486 initGl(vo_dwidth, vo_dheight); 481 initGl(vo_dwidth, vo_dheight);
487 482
488 return 0; 483 return 0;
489 } 484 }
490 485
491 static void check_events(void) 486 static void check_events(void)
492 { 487 {
493 int e=vo_check_events(); 488 int e=vo_check_events();
647 ActiveTexture(GL_TEXTURE2); 642 ActiveTexture(GL_TEXTURE2);
648 glUploadTex(gl_target, gl_format, gl_type, src[2], stride[2], 643 glUploadTex(gl_target, gl_format, gl_type, src[2], stride[2],
649 x / 2, y / 2, w / 2, h / 2, slice_height); 644 x / 2, y / 2, w / 2, h / 2, slice_height);
650 ActiveTexture(GL_TEXTURE0); 645 ActiveTexture(GL_TEXTURE0);
651 } 646 }
652 return 0; 647 return 0;
653 } 648 }
654 649
655 static uint32_t get_image(mp_image_t *mpi) { 650 static uint32_t get_image(mp_image_t *mpi) {
656 if (!GenBuffers || !BindBuffer || !BufferData || !MapBuffer) { 651 if (!GenBuffers || !BindBuffer || !BufferData || !MapBuffer) {
657 if (!err_shown) 652 if (!err_shown)