changeset 35445:19c56dc40a51

Fix alpha for ASS subtitles. EOSD always needs to use MODULATE since the vertex colour might contain alpha.
author reimar
date Fri, 30 Nov 2012 20:51:02 +0000
parents 4644c320daf4
children a25cdaa733cb
files libvo/vo_gl.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Fri Nov 30 20:11:58 2012 +0000
+++ b/libvo/vo_gl.c	Fri Nov 30 20:51:02 2012 +0000
@@ -824,14 +824,16 @@
     mpglPushMatrix();
     mpglLoadMatrixf(matrix);
   }
-  if (osd_color != 0xffffff)
-    mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
   mpglEnable(GL_BLEND);
   if (draw_eosd) {
+    mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     mpglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     mpglCallList(eosdDispList);
+    mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   }
   if (draw_osd) {
+    if (osd_color != 0xffffff)
+      mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     mpglColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff - (osd_color >> 24));
     // draw OSD
 #ifndef FAST_OSD
@@ -850,11 +852,11 @@
       mpglBindTexture(gl_target, osdtex[i]);
       glDrawTex(c->x, c->y, c->w, c->h, 0, 0, c->w, c->h, c->sx, c->sy, using_tex_rect, 0, 0, 0);
     }
+    if (osd_color != 0xffffff)
+      mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   }
   // set rendering parameters back to defaults
   mpglDisable(GL_BLEND);
-  if (osd_color != 0xffffff)
-    mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   if (!scaled_osd)
     mpglPopMatrix();
   mpglBindTexture(gl_target, 0);