Commit 9ba00f59 authored by Damien Fouilleul's avatar Damien Fouilleul

voutgl.m: support for VOUT_REDRAW_RECT in agl code, also added some smarts...

voutgl.m: support for VOUT_REDRAW_RECT in agl code, also added some smarts regarding handling null clip regions, which causes video flickers on Firefox/MacOSX when scrolling a page containing the mozilla plugin
parent d546db7e
...@@ -72,6 +72,8 @@ struct vout_sys_t ...@@ -72,6 +72,8 @@ struct vout_sys_t
int i_width, i_height; int i_width, i_height;
WindowRef theWindow; WindowRef theWindow;
WindowGroupRef winGroup; WindowGroupRef winGroup;
vlc_bool_t b_clipped_out;
Rect clipBounds, viewBounds;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -488,10 +490,17 @@ static int aglInit( vout_thread_t * p_vout ) ...@@ -488,10 +490,17 @@ static int aglInit( vout_thread_t * p_vout )
var_Get( p_vout->p_libvlc, "drawable-clip-right", &val ); var_Get( p_vout->p_libvlc, "drawable-clip-right", &val );
clipBounds.right = val.i_int; clipBounds.right = val.i_int;
p_vout->p_sys->b_clipped_out = (clipBounds.top == clipBounds.bottom)
|| (clipBounds.left == clipBounds.right);
if( ! p_vout->p_sys->b_clipped_out )
{
aglLock(p_vout); aglLock(p_vout);
aglSetViewport(p_vout, viewBounds, clipBounds); aglSetViewport(p_vout, viewBounds, clipBounds);
aglReshape(p_vout); aglReshape(p_vout);
aglUnlock(p_vout); aglUnlock(p_vout);
}
p_vout->p_sys->clipBounds = clipBounds;
p_vout->p_sys->viewBounds = viewBounds;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -694,11 +703,50 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -694,11 +703,50 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args )
clipBounds.right = va_arg( args, int); clipBounds.right = va_arg( args, int);
if( !p_vout->b_fullscreen ) if( !p_vout->b_fullscreen )
{
/*
** check that the clip rect is not empty, as this is used
** by Firefox to prevent a plugin from displaying during
** a scrolling event. In this case we just prevent buffers
** from being swapped and ignore clipping as this is less
** disruptive than a GL geometry change
*/
p_vout->p_sys->b_clipped_out = (clipBounds.top == clipBounds.bottom)
|| (clipBounds.left == clipBounds.right);
if( ! p_vout->p_sys->b_clipped_out )
{
/* ignore consecutive viewport update with identical parameters */
if( memcmp(&clipBounds, &(p_vout->p_sys->clipBounds), sizeof(clipBounds) )
&& memcmp(&viewBounds, &(p_vout->p_sys->viewBounds), sizeof(viewBounds)) )
{ {
aglLock( p_vout ); aglLock( p_vout );
aglSetViewport(p_vout, viewBounds, clipBounds); aglSetViewport(p_vout, viewBounds, clipBounds);
aglReshape( p_vout ); aglReshape( p_vout );
aglUnlock( p_vout ); aglUnlock( p_vout );
p_vout->p_sys->clipBounds = clipBounds;
p_vout->p_sys->viewBounds = viewBounds;
}
}
}
return VLC_SUCCESS;
}
case VOUT_REDRAW_RECT:
{
vout_thread_t * p_parent;
Rect areaBounds;
areaBounds.top = va_arg( args, int);
areaBounds.left = va_arg( args, int);
areaBounds.bottom = va_arg( args, int);
areaBounds.right = va_arg( args, int);
/* Ask the opengl module to redraw */
p_parent = (vout_thread_t *) p_vout->p_parent;
if( p_parent && p_parent->pf_display )
{
p_parent->pf_display( p_parent, NULL );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -721,8 +769,16 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args ) ...@@ -721,8 +769,16 @@ static int aglControl( vout_thread_t *p_vout, int i_query, va_list args )
static void aglSwap( vout_thread_t * p_vout ) static void aglSwap( vout_thread_t * p_vout )
{ {
if( ! p_vout->p_sys->b_clipped_out )
{
p_vout->p_sys->b_got_frame = VLC_TRUE; p_vout->p_sys->b_got_frame = VLC_TRUE;
aglSwapBuffers(p_vout->p_sys->agl_ctx); aglSwapBuffers(p_vout->p_sys->agl_ctx);
}
else
{
/* drop frame */
glFlush();
}
} }
/* Enter this function with the p_vout locked */ /* Enter this function with the p_vout locked */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment