Commit 94f55cc6 authored by Gildas Bazin's avatar Gildas Bazin

* modules/video_output/directx: use a black overlay colorkey for 24 bits colour depth displays.

parent 935a2e8d
...@@ -94,7 +94,7 @@ static void DirectXGetDDrawCaps ( vout_thread_t *p_vout ); ...@@ -94,7 +94,7 @@ static void DirectXGetDDrawCaps ( vout_thread_t *p_vout );
static int DirectXLockSurface ( vout_thread_t *p_vout, picture_t *p_pic ); static int DirectXLockSurface ( vout_thread_t *p_vout, picture_t *p_pic );
static int DirectXUnlockSurface ( vout_thread_t *p_vout, picture_t *p_pic ); static int DirectXUnlockSurface ( vout_thread_t *p_vout, picture_t *p_pic );
static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t i_color ); static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t *i_color );
void SwitchWallpaperMode( vout_thread_t *, vlc_bool_t ); void SwitchWallpaperMode( vout_thread_t *, vlc_bool_t );
...@@ -218,7 +218,7 @@ static int OpenVideo( vlc_object_t *p_this ) ...@@ -218,7 +218,7 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->GetMonitorInfo = NULL; p_vout->p_sys->GetMonitorInfo = NULL;
if( (huser32 = GetModuleHandle( _T("USER32") ) ) ) if( (huser32 = GetModuleHandle( _T("USER32") ) ) )
{ {
p_vout->p_sys->MonitorFromWindow = p_vout->p_sys->MonitorFromWindow = (HMONITOR (WINAPI *)( HWND, DWORD ))
GetProcAddress( huser32, _T("MonitorFromWindow") ); GetProcAddress( huser32, _T("MonitorFromWindow") );
p_vout->p_sys->GetMonitorInfo = p_vout->p_sys->GetMonitorInfo =
#ifndef UNICODE #ifndef UNICODE
...@@ -1017,7 +1017,7 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout ) ...@@ -1017,7 +1017,7 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout )
/* Make sure the colorkey will be painted */ /* Make sure the colorkey will be painted */
p_vout->p_sys->i_colorkey = 1; p_vout->p_sys->i_colorkey = 1;
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 */ /* Create the actual brush */
SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND, SetClassLong( p_vout->p_sys->hvideownd, GCL_HBRBACKGROUND,
...@@ -1906,7 +1906,7 @@ static int DirectXUnlockSurface( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1906,7 +1906,7 @@ static int DirectXUnlockSurface( vout_thread_t *p_vout, picture_t *p_pic )
/***************************************************************************** /*****************************************************************************
* DirectXFindColorkey: Finds out the 32bits RGB pixel value of the colorkey * DirectXFindColorkey: Finds out the 32bits RGB pixel value of the colorkey
*****************************************************************************/ *****************************************************************************/
static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t i_color ) static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t *pi_color )
{ {
DDSURFACEDESC ddsd; DDSURFACEDESC ddsd;
HRESULT dxresult; HRESULT dxresult;
...@@ -1924,16 +1924,20 @@ static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t i_color ) ...@@ -1924,16 +1924,20 @@ static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t i_color )
switch( ddsd.ddpfPixelFormat.dwRGBBitCount ) switch( ddsd.ddpfPixelFormat.dwRGBBitCount )
{ {
case 4: case 4:
*(uint8_t *)ddsd.lpSurface = 0x11; *(uint8_t *)ddsd.lpSurface = *pi_color | (*pi_color << 4);
break; break;
case 8: case 8:
*(uint8_t *)ddsd.lpSurface = 0x01; *(uint8_t *)ddsd.lpSurface = *pi_color;
break; break;
case 15:
case 16: case 16:
*(uint16_t *)ddsd.lpSurface = 0x01; *(uint16_t *)ddsd.lpSurface = *pi_color;
break; break;
case 24:
/* Seems to be problematic so we'll just put black as the colorkey */
*pi_color = 0;
default: default:
*(uint32_t *)ddsd.lpSurface = 0x01; *(uint32_t *)ddsd.lpSurface = *pi_color;
break; break;
} }
......
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