From 16d4e09b994a8955775193fe482ad216bb90ea0f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 21 Oct 2012 13:42:52 +0200 Subject: vo_corevideo: fix EOSD artifacts The new EOSD code suffered from artifacts due to missing setup of a projection matrix. This commit fixes the problem and uniforms the resize code to the one driving vo_opengl_old. --- libvo/vo_corevideo.m | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 16e53abeb5..06010cad49 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -66,16 +66,11 @@ static void resize(struct vo *vo, int width, int height) { struct priv *p = vo->priv; GL *gl = p->mpglctx->gl; - p->image_width = width; - p->image_height = height; - - mp_msg(MSGT_VO, MSGL_V, "[vo_corevideo] New OpenGL Viewport (0, 0, %d, " - "%d)\n", p->image_width, p->image_height); - gl->Viewport(0, 0, p->image_width, p->image_height); + gl->Viewport(0, 0, width, height); gl->MatrixMode(GL_PROJECTION); gl->LoadIdentity(); - + p->ass_border_x = p->ass_border_y = 0; if (aspect_scaling()) { int new_w, new_h; GLdouble scale_x, scale_y; @@ -84,8 +79,8 @@ static void resize(struct vo *vo, int width, int height) panscan_calc_windowed(vo); new_w += vo->panscan_x; new_h += vo->panscan_y; - scale_x = (GLdouble)new_w / (GLdouble)p->image_width; - scale_y = (GLdouble)new_h / (GLdouble)p->image_height; + scale_x = (GLdouble)new_w / (GLdouble)width; + scale_y = (GLdouble)new_h / (GLdouble)height; gl->Scaled(scale_x, scale_y, 1); p->ass_border_x = (vo->dwidth - new_w) / 2; p->ass_border_y = (vo->dheight - new_h) / 2; @@ -304,18 +299,26 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) GL *gl = p->mpglctx->gl; assert(p->osd); + gl->MatrixMode(GL_PROJECTION); + gl->PushMatrix(); + gl->LoadIdentity(); + gl->Ortho(0, vo->dwidth, vo->dheight, 0, -1, 1); + struct mp_osd_res res = { .w = vo->dwidth, .h = vo->dheight, - .ml = p->ass_border_x, - .mr = p->ass_border_x, - .mt = p->ass_border_y, - .mb = p->ass_border_y, .display_par = vo->monitor_par, .video_par = vo->aspdat.par, }; + if (aspect_scaling()) { + res.ml = res.mr = p->ass_border_x; + res.mt = res.mb = p->ass_border_y; + } + mpgl_osd_draw_legacy(p->osd, osd, res); + + gl->PopMatrix(); } static CFStringRef get_cv_csp_matrix(struct vo *vo) -- cgit v1.2.3