comparison libvo/vo_gl.c @ 36156:056cd00eba14

Remove pointless function arguments. The have the same value as vo_dwidth/vo_dheight and whether those are used or the arguments is completely random, making the code hard to follow.
author reimar
date Thu, 09 May 2013 07:18:47 +0000
parents 4129ba181ad7
children 94979f661d38
comparison
equal deleted inserted replaced
36155:29c690aefc6f 36156:056cd00eba14
175 175
176 static void redraw(void); 176 static void redraw(void);
177 177
178 static float video_matrix[16]; 178 static float video_matrix[16];
179 179
180 static void resize(int x,int y){ 180 static void resize(void) {
181 // simple orthogonal projection for 0-image_width;0-image_height 181 // simple orthogonal projection for 0-image_width;0-image_height
182 memset(video_matrix, 0, sizeof(video_matrix)); 182 memset(video_matrix, 0, sizeof(video_matrix));
183 video_matrix[0] = 2.0/image_width; 183 video_matrix[0] = 2.0/image_width;
184 video_matrix[5] = -2.0/image_height; 184 video_matrix[5] = -2.0/image_height;
185 video_matrix[12] = -1; 185 video_matrix[12] = -1;
186 video_matrix[13] = 1; 186 video_matrix[13] = 1;
187 video_matrix[15] = 1; 187 video_matrix[15] = 1;
188 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y); 188 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n", vo_dwidth, vo_dheight);
189 if (WinID >= 0) { 189 if (WinID >= 0) {
190 int left = 0, top = 0, w = x, h = y; 190 int left = 0, top = 0, w = vo_dwidth, h = vo_dheight;
191 geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight); 191 geometry(&left, &top, &w, &h, vo_dwidth, vo_dheight);
192 top = y - h - top; 192 top = vo_dheight - h - top;
193 mpglViewport(left, top, w, h); 193 mpglViewport(left, top, w, h);
194 } else 194 } else
195 mpglViewport( 0, 0, x, y ); 195 mpglViewport(0, 0, vo_dwidth, vo_dheight);
196 196
197 ass_border_x = ass_border_y = 0; 197 ass_border_x = ass_border_y = 0;
198 if (aspect_scaling() && use_aspect) { 198 if (aspect_scaling() && use_aspect) {
199 int new_w, new_h; 199 int new_w, new_h;
200 double scale_x, scale_y; 200 double scale_x, scale_y;
201 aspect(&new_w, &new_h, A_WINZOOM); 201 aspect(&new_w, &new_h, A_WINZOOM);
202 panscan_calc_windowed(); 202 panscan_calc_windowed();
203 new_w += vo_panscan_x; 203 new_w += vo_panscan_x;
204 new_h += vo_panscan_y; 204 new_h += vo_panscan_y;
205 scale_x = (double)new_w / (double)x; 205 scale_x = (double)new_w / (double)vo_dwidth;
206 scale_y = (double)new_h / (double)y; 206 scale_y = (double)new_h / (double)vo_dheight;
207 video_matrix[0] *= scale_x; 207 video_matrix[0] *= scale_x;
208 video_matrix[12] *= scale_x; 208 video_matrix[12] *= scale_x;
209 video_matrix[5] *= scale_y; 209 video_matrix[5] *= scale_y;
210 video_matrix[13] *= scale_y; 210 video_matrix[13] *= scale_y;
211 ass_border_x = (vo_dwidth - new_w) / 2; 211 ass_border_x = (vo_dwidth - new_w) / 2;
545 545
546 /** 546 /**
547 * \brief Initialize a (new or reused) OpenGL context. 547 * \brief Initialize a (new or reused) OpenGL context.
548 * set global gl-related variables to their default values 548 * set global gl-related variables to their default values
549 */ 549 */
550 static int initGl(uint32_t d_width, uint32_t d_height) { 550 static int initGl(void) {
551 GLint scale_type = get_scale_type(0); 551 GLint scale_type = get_scale_type(0);
552 autodetectGlExtensions(); 552 autodetectGlExtensions();
553 using_tex_rect = gl_format == GL_YCBCR_422_APPLE || use_rectangle == 1; 553 using_tex_rect = gl_format == GL_YCBCR_422_APPLE || use_rectangle == 1;
554 gl_target = using_tex_rect ? GL_TEXTURE_RECTANGLE : GL_TEXTURE_2D; 554 gl_target = using_tex_rect ? GL_TEXTURE_RECTANGLE : GL_TEXTURE_2D;
555 yuvconvtype = SET_YUV_CONVERSION(use_yuv) | 555 yuvconvtype = SET_YUV_CONVERSION(use_yuv) |
621 } 621 }
622 } 622 }
623 update_yuvconv(); 623 update_yuvconv();
624 } 624 }
625 625
626 resize(d_width, d_height); 626 resize();
627 627
628 mpglClearColor( 0.0f,0.0f,0.0f,0.0f ); 628 mpglClearColor( 0.0f,0.0f,0.0f,0.0f );
629 mpglClear( GL_COLOR_BUFFER_BIT ); 629 mpglClear( GL_COLOR_BUFFER_BIT );
630 if (mpglSwapInterval && swap_interval >= 0) 630 if (mpglSwapInterval && swap_interval >= 0)
631 mpglSwapInterval(swap_interval); 631 mpglSwapInterval(swap_interval);
700 700
701 #ifdef CONFIG_GL_OSX 701 #ifdef CONFIG_GL_OSX
702 static void osx_redraw(void) 702 static void osx_redraw(void)
703 { 703 {
704 // resize will call redraw to refresh the screen 704 // resize will call redraw to refresh the screen
705 resize(vo_dwidth, vo_dheight); 705 resize();
706 } 706 }
707 #endif 707 #endif
708 708
709 /* connect to server, create and map window, 709 /* connect to server, create and map window,
710 * allocate colors and (shared) memory 710 * allocate colors and (shared) memory
742 return -1; 742 return -1;
743 if (mesa_buffer && !mpglAllocateMemoryMESA) { 743 if (mesa_buffer && !mpglAllocateMemoryMESA) {
744 mp_msg(MSGT_VO, MSGL_ERR, "Can not enable mesa-buffer because AllocateMemoryMESA was not found\n"); 744 mp_msg(MSGT_VO, MSGL_ERR, "Can not enable mesa-buffer because AllocateMemoryMESA was not found\n");
745 mesa_buffer = 0; 745 mesa_buffer = 0;
746 } 746 }
747 initGl(vo_dwidth, vo_dheight); 747 initGl();
748 748
749 #ifdef CONFIG_GL_OSX 749 #ifdef CONFIG_GL_OSX
750 vo_osx_redraw_func = osx_redraw; 750 vo_osx_redraw_func = osx_redraw;
751 #endif 751 #endif
752 return 0; 752 return 0;
755 static void check_events(void) 755 static void check_events(void)
756 { 756 {
757 int e=glctx.check_events(); 757 int e=glctx.check_events();
758 if(e&VO_EVENT_REINIT) { 758 if(e&VO_EVENT_REINIT) {
759 uninitGl(); 759 uninitGl();
760 initGl(vo_dwidth, vo_dheight); 760 initGl();
761 } 761 }
762 if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight); 762 if(e&VO_EVENT_RESIZE) resize();
763 else if(e&VO_EVENT_EXPOSE) redraw(); 763 else if(e&VO_EVENT_EXPOSE) redraw();
764 } 764 }
765 765
766 /** 766 /**
767 * Creates the textures and the display list needed for displaying 767 * Creates the textures and the display list needed for displaying
1478 case VOCTRL_ONTOP: 1478 case VOCTRL_ONTOP:
1479 glctx.ontop(); 1479 glctx.ontop();
1480 return VO_TRUE; 1480 return VO_TRUE;
1481 case VOCTRL_FULLSCREEN: 1481 case VOCTRL_FULLSCREEN:
1482 glctx.fullscreen(); 1482 glctx.fullscreen();
1483 resize(vo_dwidth, vo_dheight); 1483 resize();
1484 return VO_TRUE; 1484 return VO_TRUE;
1485 case VOCTRL_BORDER: 1485 case VOCTRL_BORDER:
1486 glctx.border(); 1486 glctx.border();
1487 resize(vo_dwidth, vo_dheight); 1487 resize();
1488 return VO_TRUE; 1488 return VO_TRUE;
1489 case VOCTRL_GET_PANSCAN: 1489 case VOCTRL_GET_PANSCAN:
1490 if (!use_aspect) return VO_NOTIMPL; 1490 if (!use_aspect) return VO_NOTIMPL;
1491 return VO_TRUE; 1491 return VO_TRUE;
1492 case VOCTRL_SET_PANSCAN: 1492 case VOCTRL_SET_PANSCAN:
1493 if (!use_aspect) return VO_NOTIMPL; 1493 if (!use_aspect) return VO_NOTIMPL;
1494 resize(vo_dwidth, vo_dheight); 1494 resize();
1495 return VO_TRUE; 1495 return VO_TRUE;
1496 case VOCTRL_GET_EQUALIZER: 1496 case VOCTRL_GET_EQUALIZER:
1497 if (is_yuv) { 1497 if (is_yuv) {
1498 int i; 1498 int i;
1499 vf_equalizer_t *eq=data; 1499 vf_equalizer_t *eq=data;