mirror of
https://github.com/mpv-player/mpv
synced 2025-02-21 23:36:58 +00:00
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28838 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
27b512e1f5
commit
397c4db88b
@ -284,6 +284,8 @@ static void clearEOSD(void) {
|
||||
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 @@ static void genEOSD(mp_eosd_images_t *imgs) {
|
||||
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 @@ skip_upload:
|
||||
}
|
||||
glEndList();
|
||||
BindTexture(gl_target, 0);
|
||||
call_render:
|
||||
if (vo_doublebuffering) do_render_osd(2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -630,8 +634,6 @@ static void create_osd_texture(int x0, int y0, int w, int h,
|
||||
osdtexCnt++;
|
||||
}
|
||||
|
||||
static void do_render_osd(void);
|
||||
|
||||
static void draw_osd(void)
|
||||
{
|
||||
if (!use_osd) return;
|
||||
@ -643,7 +645,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();
|
||||
if (vo_doublebuffering) do_render_osd(1);
|
||||
}
|
||||
|
||||
static void do_render(void) {
|
||||
@ -662,8 +664,11 @@ static void do_render(void) {
|
||||
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 @@ static void do_render_osd(void) {
|
||||
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 @@ static void flip_page(void) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user