changeset 28803:6887c715c4fa

Do not rely on draw_osd to render the EOSD, instead draw it already at the end of genOSD. Fixes that the EOSD was drawn one frame too late.
author reimar
date Fri, 06 Mar 2009 10:33:35 +0000
parents 0d4550d07af0
children 5ccdec6c14f0
files libvo/vo_gl.c
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Fri Mar 06 09:20:14 2009 +0000
+++ b/libvo/vo_gl.c	Fri Mar 06 10:33:35 2009 +0000
@@ -284,6 +284,8 @@
   eosdtex = NULL;
 }
 
+static void do_render_osd(int);
+
 /**
  * \brief construct display list from ass image list
  * \param img image list to create OSD from.
@@ -299,7 +301,7 @@
   ass_image_t *i;
 
   if (imgs->changed == 0) // there are elements, but they are unchanged
-      return;
+      goto call_render;
   if (img && imgs->changed == 1) // there are elements, but they just moved
       goto skip_upload;
 
@@ -384,6 +386,8 @@
   }
   glEndList();
   BindTexture(gl_target, 0);
+call_render:
+  if (vo_doublebuffering) do_render_osd(2);
 }
 
 /**
@@ -630,8 +634,6 @@
   osdtexCnt++;
 }
 
-static void do_render_osd(void);
-
 static void draw_osd(void)
 {
   if (!use_osd) return;
@@ -643,7 +645,7 @@
     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();
+  if (vo_doublebuffering) do_render_osd(1);
 }
 
 static void do_render(void) {
@@ -662,8 +664,11 @@
     glDisableYUVConversion(gl_target, yuvconvtype);
 }
 
-static void do_render_osd(void) {
-  if (osdtexCnt > 0 || eosdDispList) {
+/**
+ * \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)) {
     // set special rendering parameters
     if (!scaled_osd) {
       glMatrixMode(GL_PROJECTION);
@@ -672,11 +677,11 @@
       glOrtho(0, vo_dwidth, vo_dheight, 0, -1, 1);
     }
     glEnable(GL_BLEND);
-    if (eosdDispList) {
+    if ((type & 2) && eosdDispList) {
       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
       glCallList(eosdDispList);
     }
-    if (osdtexCnt > 0) {
+    if ((type & 1) && osdtexCnt > 0) {
       glColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff - (osd_color >> 24));
       // draw OSD
 #ifndef FAST_OSD
@@ -702,14 +707,14 @@
       glClear(GL_COLOR_BUFFER_BIT);
   } else {
     do_render();
-    do_render_osd();
+    do_render_osd(3);
     if (use_glFinish) glFinish();
     else glFlush();
   }
 }
 
 static void redraw(void) {
-  if (vo_doublebuffering) { do_render(); do_render_osd(); }
+  if (vo_doublebuffering) { do_render(); do_render_osd(3); }
   flip_page();
 }