[MPlayer-cvslog] r31886 - trunk/libvo/vo_gl.c

reimar subversion at mplayerhq.hu
Sun Aug 1 19:36:15 CEST 2010


Author: reimar
Date: Sun Aug  1 19:36:15 2010
New Revision: 31886

Log:
More readable OSD rendering code.

Modified:
   trunk/libvo/vo_gl.c

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Sun Aug  1 15:58:35 2010	(r31885)
+++ trunk/libvo/vo_gl.c	Sun Aug  1 19:36:15 2010	(r31886)
@@ -751,11 +751,16 @@ static void create_osd_texture(int x0, i
   osdtexCnt++;
 }
 
+#define RENDER_OSD  1
+#define RENDER_EOSD 2
+
 /**
  * \param type bit 0: render OSD, bit 1: render EOSD
  */
 static void do_render_osd(int type) {
-  if (((type & 1) && osdtexCnt > 0) || ((type & 2) && eosdDispList)) {
+  int draw_osd  = (type & RENDER_OSD)  && osdtexCnt > 0;
+  int draw_eosd = (type & RENDER_EOSD) && eosdDispList;
+  if (draw_osd || draw_eosd) {
     // set special rendering parameters
     if (!scaled_osd) {
       mpglMatrixMode(GL_PROJECTION);
@@ -764,11 +769,11 @@ static void do_render_osd(int type) {
       mpglOrtho(0, vo_dwidth, vo_dheight, 0, -1, 1);
     }
     mpglEnable(GL_BLEND);
-    if ((type & 2) && eosdDispList) {
+    if (draw_eosd) {
       mpglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
       mpglCallList(eosdDispList);
     }
-    if ((type & 1) && osdtexCnt > 0) {
+    if (draw_osd) {
       mpglColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff - (osd_color >> 24));
       // draw OSD
 #ifndef FAST_OSD
@@ -797,7 +802,7 @@ static void draw_osd(void)
     vo_draw_text_ext(osd_w, osd_h, ass_border_x, ass_border_y, ass_border_x, ass_border_y,
                      image_width, image_height, create_osd_texture);
   }
-  if (vo_doublebuffering) do_render_osd(1);
+  if (vo_doublebuffering) do_render_osd(RENDER_OSD);
 }
 
 static void do_render(void) {
@@ -840,14 +845,14 @@ static void flip_page(void) {
       mpglClear(GL_COLOR_BUFFER_BIT);
   } else {
     do_render();
-    do_render_osd(3);
+    do_render_osd(RENDER_OSD | RENDER_EOSD);
     if (use_glFinish) mpglFinish();
     else mpglFlush();
   }
 }
 
 static void redraw(void) {
-  if (vo_doublebuffering) { do_render(); do_render_osd(3); }
+  if (vo_doublebuffering) { do_render(); do_render_osd(RENDER_OSD | RENDER_EOSD); }
   flip_page();
 }
 
@@ -1314,7 +1319,7 @@ static int control(uint32_t request, voi
     if (!data)
       return VO_FALSE;
     genEOSD(data);
-    if (vo_doublebuffering) do_render_osd(2);
+    if (vo_doublebuffering) do_render_osd(RENDER_EOSD);
     return VO_TRUE;
   case VOCTRL_GET_EOSD_RES:
     {


More information about the MPlayer-cvslog mailing list