Mercurial > mplayer.hg
comparison libvo/vo_gl2.c @ 23645:6f2f38eb4e0a
Remove some unused code and useless error checking that only clutters the code
author | reimar |
---|---|
date | Tue, 26 Jun 2007 15:01:09 +0000 |
parents | 17bf4f4b0715 |
children | ee915faa2a2e |
comparison
equal
deleted
inserted
replaced
23644:73714a7a98cf | 23645:6f2f38eb4e0a |
---|---|
18 #include "gl_common.h" | 18 #include "gl_common.h" |
19 #include "aspect.h" | 19 #include "aspect.h" |
20 #ifdef HAVE_NEW_GUI | 20 #ifdef HAVE_NEW_GUI |
21 #include "gui/interface.h" | 21 #include "gui/interface.h" |
22 #endif | 22 #endif |
23 | |
24 #define NDEBUG | |
25 //#undef NDEBUG | |
26 | 23 |
27 #undef TEXTUREFORMAT_ALWAYS | 24 #undef TEXTUREFORMAT_ALWAYS |
28 #ifdef SYS_DARWIN | 25 #ifdef SYS_DARWIN |
29 #define TEXTUREFORMAT_ALWAYS GL_RGBA8 | 26 #define TEXTUREFORMAT_ALWAYS GL_RGBA8 |
30 #endif | 27 #endif |
266 glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[0]); | 263 glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[0]); |
267 ActiveTexture(GL_TEXTURE2); | 264 ActiveTexture(GL_TEXTURE2); |
268 glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[1]); | 265 glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[1]); |
269 ActiveTexture(GL_TEXTURE0); | 266 ActiveTexture(GL_TEXTURE0); |
270 } | 267 } |
271 err = glGetError (); | |
272 if(err==GL_INVALID_ENUM) | |
273 { | |
274 mp_msg (MSGT_VO, MSGL_ERR, "GLERROR glBindTexture (glGenText) := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, tsq->texobj); | |
275 } | |
276 | |
277 if(glIsTexture(tsq->texobj) == GL_FALSE) | |
278 { | |
279 mp_msg (MSGT_VO, MSGL_ERR, "GLERROR ain't a texture (glGenText): texnum x=%d, y=%d, texture=%d\n", | |
280 x, y, tsq->texobj); | |
281 } else { | |
282 tsq->isTexture=GL_TRUE; | 268 tsq->isTexture=GL_TRUE; |
283 } | |
284 | 269 |
285 glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, GL_LINEAR, | 270 glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, GL_LINEAR, |
286 texture_width, texture_height, 0); | 271 texture_width, texture_height, 0); |
287 | 272 |
288 glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | 273 glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
360 wh=(wdecr<wd)?wdecr:wd-xh; | 345 wh=(wdecr<wd)?wdecr:wd-xh; |
361 if(wh<0) wh=0; | 346 if(wh<0) wh=0; |
362 | 347 |
363 hh=(hdecr<ht)?hdecr:ht-yh; | 348 hh=(hdecr<ht)?hdecr:ht-yh; |
364 if(hh<0) hh=0; | 349 if(hh<0) hh=0; |
365 | |
366 /* | |
367 #ifndef NDEBUG | |
368 printf("\t %dx%d, %d/%d (%dx%d): %d/%d (%dx%d)\n", | |
369 xi, yi, xh, yh, wdecr, hdecr, xh, yh, wh, hh); | |
370 #endif | |
371 */ | |
372 | 350 |
373 if(xh<square->dirtyXoff) | 351 if(xh<square->dirtyXoff) |
374 square->dirtyXoff=xh; | 352 square->dirtyXoff=xh; |
375 | 353 |
376 if(yh<square->dirtyYoff) | 354 if(yh<square->dirtyYoff) |
470 | 448 |
471 | 449 |
472 static void drawTextureDisplay (void) | 450 static void drawTextureDisplay (void) |
473 { | 451 { |
474 struct TexSquare *square = texgrid; | 452 struct TexSquare *square = texgrid; |
475 int x, y/*, xoff=0, yoff=0, wd, ht*/; | 453 int x, y; |
476 GLenum err; | 454 GLenum err; |
477 | 455 |
478 glColor3f(1.0,1.0,1.0); | 456 glColor3f(1.0,1.0,1.0); |
479 | 457 |
480 if (image_format == IMGFMT_YV12) | 458 if (image_format == IMGFMT_YV12) |
481 glEnableYUVConversion(GL_TEXTURE_2D, use_yuv); | 459 glEnableYUVConversion(GL_TEXTURE_2D, use_yuv); |
482 for (y = 0; y < texnumy; y++) | 460 for (y = 0; y < texnumy; y++) |
483 { | 461 { |
484 for (x = 0; x < texnumx; x++) | 462 for (x = 0; x < texnumx; x++) |
485 { | 463 { |
486 if(square->isTexture==GL_FALSE) | |
487 { | |
488 mp_msg (MSGT_VO, MSGL_V, "[gl2] ain't a texture(update): texnum x=%d, y=%d, texture=%d\n", | |
489 x, y, square->texobj); | |
490 continue; | |
491 } | |
492 | |
493 glBindTexture (GL_TEXTURE_2D, square->texobj); | 464 glBindTexture (GL_TEXTURE_2D, square->texobj); |
494 if (image_format == IMGFMT_YV12) { | 465 if (image_format == IMGFMT_YV12) { |
495 ActiveTexture(GL_TEXTURE1); | 466 ActiveTexture(GL_TEXTURE1); |
496 glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[0]); | 467 glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[0]); |
497 ActiveTexture(GL_TEXTURE2); | 468 ActiveTexture(GL_TEXTURE2); |
498 glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[1]); | 469 glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[1]); |
499 ActiveTexture(GL_TEXTURE0); | 470 ActiveTexture(GL_TEXTURE0); |
500 } | 471 } |
501 err = glGetError (); | |
502 if(err==GL_INVALID_ENUM) | |
503 { | |
504 mp_msg (MSGT_VO, MSGL_ERR, "GLERROR glBindTexture := GL_INVALID_ENUM, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj); | |
505 } | |
506 else if(err==GL_INVALID_OPERATION) { | |
507 mp_msg (MSGT_VO, MSGL_V, "GLERROR glBindTexture := GL_INVALID_OPERATION, texnum x=%d, y=%d, texture=%d\n", x, y, square->texobj); | |
508 } | |
509 | |
510 #ifndef NDEBUG | |
511 if(glIsTexture(square->texobj) == GL_FALSE) | |
512 { | |
513 square->isTexture=GL_FALSE; | |
514 mp_msg (MSGT_VO, MSGL_ERR, "GLERROR ain't a texture(update): texnum x=%d, y=%d, texture=%d\n", | |
515 x, y, square->texobj); | |
516 } | |
517 #endif | |
518 | 472 |
519 if(square->isDirty) | 473 if(square->isDirty) |
520 { | 474 { |
521 glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type, | 475 glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type, |
522 square->texture, image_width * image_bytes, | 476 square->texture, image_width * image_bytes, |
538 square++; | 492 square++; |
539 } /* for all texnumx */ | 493 } /* for all texnumx */ |
540 } /* for all texnumy */ | 494 } /* for all texnumy */ |
541 if (image_format == IMGFMT_YV12) | 495 if (image_format == IMGFMT_YV12) |
542 glDisableYUVConversion(GL_TEXTURE_2D, use_yuv); | 496 glDisableYUVConversion(GL_TEXTURE_2D, use_yuv); |
543 | |
544 /* YES - let's catch this error ... | |
545 */ | |
546 (void) glGetError (); | |
547 } | 497 } |
548 | 498 |
549 | 499 |
550 static void resize(int *x,int *y){ | 500 static void resize(int *x,int *y){ |
551 mp_msg(MSGT_VO,MSGL_V,"[gl2] Resize: %dx%d\n",*x,*y); | 501 mp_msg(MSGT_VO,MSGL_V,"[gl2] Resize: %dx%d\n",*x,*y); |
683 hint.width = d_width; | 633 hint.width = d_width; |
684 hint.height = d_height; | 634 hint.height = d_height; |
685 hint.flags = PPosition | PSize; | 635 hint.flags = PPosition | PSize; |
686 | 636 |
687 /* Make the window */ | 637 /* Make the window */ |
688 | |
689 // XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); | |
690 | |
691 // XMatchVisualInfo(mDisplay, screen, depth, TrueColor, &vinfo); | |
692 vinfo = choose_glx_visual(mDisplay,mScreen,&vinfo_buf) < 0 ? NULL : &vinfo_buf; | 638 vinfo = choose_glx_visual(mDisplay,mScreen,&vinfo_buf) < 0 ? NULL : &vinfo_buf; |
693 if (vinfo == NULL) | 639 if (vinfo == NULL) |
694 { | 640 { |
695 mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] no GLX support present\n"); | 641 mp_msg(MSGT_VO, MSGL_FATAL, "[gl2] no GLX support present\n"); |
696 return -1; | 642 return -1; |
943 | 889 |
944 if (vo_fs) // Avoid flickering borders in fullscreen mode | 890 if (vo_fs) // Avoid flickering borders in fullscreen mode |
945 glClear (GL_COLOR_BUFFER_BIT); | 891 glClear (GL_COLOR_BUFFER_BIT); |
946 } | 892 } |
947 | 893 |
948 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num) | |
949 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) | 894 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) |
950 { | 895 { |
951 uint8_t *yptr = src[0], *uptr = src[1], *vptr = src[2]; | 896 uint8_t *yptr = src[0], *uptr = src[1], *vptr = src[2]; |
952 int ystride = stride[0], ustride = stride[1], vstride = stride[2]; | 897 int ystride = stride[0], ustride = stride[1], vstride = stride[2]; |
953 int rem_h = h; | 898 int rem_h = h; |