Commit 1a81de01 authored by Damien Fouilleul's avatar Damien Fouilleul

directx.c: fixed the initial grey flicker when using overlay surfaces by...

directx.c: fixed the initial grey flicker when using overlay surfaces by postponing painting the overlay colorkey until the first picture has been received the vout display
parent f77f9497
...@@ -76,6 +76,7 @@ static int Init ( vout_thread_t * ); ...@@ -76,6 +76,7 @@ static int Init ( vout_thread_t * );
static void End ( vout_thread_t * ); static void End ( vout_thread_t * );
static int Manage ( vout_thread_t * ); static int Manage ( vout_thread_t * );
static void Display ( vout_thread_t *, picture_t * ); static void Display ( vout_thread_t *, picture_t * );
static void OverlayDisplay( vout_thread_t *, picture_t * );
static void SetPalette( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * ); static void SetPalette( vout_thread_t *, uint16_t *, uint16_t *, uint16_t * );
static int NewPictureVec ( vout_thread_t *, picture_t *, int ); static int NewPictureVec ( vout_thread_t *, picture_t *, int );
...@@ -437,6 +438,11 @@ static int Init( vout_thread_t *p_vout ) ...@@ -437,6 +438,11 @@ static int Init( vout_thread_t *p_vout )
NewPictureVec( p_vout, p_vout->p_picture, MAX_DIRECTBUFFERS ); NewPictureVec( p_vout, p_vout->p_picture, MAX_DIRECTBUFFERS );
} }
if( p_vout->p_sys->b_using_overlay )
{
p_vout->pf_display = OverlayDisplay;
}
/* Change the window title bar text */ /* Change the window title bar text */
PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 ); PostMessage( p_vout->p_sys->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
...@@ -838,6 +844,23 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -838,6 +844,23 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
} }
} }
/*
** this function is only used once when the first picture is received
** The overlay colorkey replaces black as the background color on the
** video window; this will cause the overlay surface to be displayed
*/
static void OverlayDisplay( vout_thread_t *p_vout, picture_t *p_pic )
{
/* set the colorkey as the backgound brush for the video window */
SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND,
(LONG)CreateSolidBrush( p_vout->p_sys->i_rgb_colorkey ) );
InvalidateRect( p_vout->p_sys->hvideownd, NULL, TRUE );
/* use and restores proper display function for further pictures */
p_vout->pf_display = Display;
Display(p_vout, p_pic);
}
/* following functions are local */ /* following functions are local */
/***************************************************************************** /*****************************************************************************
...@@ -1083,9 +1106,11 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout ) ...@@ -1083,9 +1106,11 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout )
p_vout->p_sys->i_rgb_colorkey = p_vout->p_sys->i_rgb_colorkey =
DirectXFindColorkey( p_vout, &p_vout->p_sys->i_colorkey ); DirectXFindColorkey( p_vout, &p_vout->p_sys->i_colorkey );
/* Create the actual brush */ /* use black brush as the video background color,
if overlay video is used, this will be replaced by the
colorkey when the first picture is received */
SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND, SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND,
(LONG)CreateSolidBrush( p_vout->p_sys->i_rgb_colorkey ) ); (LONG)GetStockObject( BLACK_BRUSH ) );
InvalidateRect( p_vout->p_sys->hvideownd, NULL, TRUE ); InvalidateRect( p_vout->p_sys->hvideownd, NULL, TRUE );
E_(DirectXUpdateRects)( p_vout, VLC_TRUE ); E_(DirectXUpdateRects)( p_vout, VLC_TRUE );
......
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