diff --git a/reactos/dll/directx/d3d9/d3d9_device.c b/reactos/dll/directx/d3d9/d3d9_device.c index 08ff6e5f70e..1fdd93f4a1d 100644 --- a/reactos/dll/directx/d3d9/d3d9_device.c +++ b/reactos/dll/directx/d3d9/d3d9_device.c @@ -650,9 +650,57 @@ HRESULT WINAPI IDirect3DDevice9Base_SetDialogBoxMode(LPDIRECT3DDEVICE9 iface, BO return D3D_OK; } +/*++ +* @name IDirect3DDevice9::SetGammaRamp +* @implemented +* +* The function IDirect3DDevice9Base_SetGammaRamp sets the gamma correction ramp values +* for the specified swap chain. +* +* @param LPDIRECT3D iface +* Pointer to the IDirect3DDevice9 object returned from IDirect3D9::CreateDevice(). +* +* @param UINT iSwapChain +* Swap chain index to get object for. +* The maximum value for this is the value returned by IDirect3DDevice9::GetNumberOfSwapChains() - 1. +* +* @param UINT Flags +* Can be on of the following: +* D3DSGR_CALIBRATE - Detects if a gamma calibrator is installed and if so modifies the values to correspond to +* the monitor and system settings before sending them to the display device. +* D3DSGR_NO_CALIBRATION - The gamma calibrations values are sent directly to the display device without +* any modification. +* +* @param CONST D3DGAMMARAMP* pRamp +* Pointer to a D3DGAMMARAMP representing the gamma correction ramp values to be set. +* +*/ VOID WINAPI IDirect3DDevice9Base_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { - UNIMPLEMENTED + IDirect3DSwapChain9* pSwapChain = NULL; + Direct3DSwapChain9_INT* pSwapChain_INT; + LPDIRECT3DDEVICE9_INT This = IDirect3DDevice9ToImpl(iface); + LOCK_D3DDEVICE9(); + + IDirect3DDevice9Base_GetSwapChain(iface, iSwapChain, &pSwapChain); + if (NULL == pSwapChain) + { + DPRINT1("Invalid iSwapChain parameter specified"); + UNLOCK_D3DDEVICE9(); + return; + } + + if (NULL == pRamp) + { + DPRINT1("Invalid pRamp parameter specified"); + UNLOCK_D3DDEVICE9(); + return; + } + + pSwapChain_INT = IDirect3DSwapChain9ToImpl(pSwapChain); + Direct3DSwapChain9_SetGammaRamp(pSwapChain_INT, Flags, pRamp); + + UNLOCK_D3DDEVICE9(); } /*++ diff --git a/reactos/dll/directx/d3d9/d3d9_swapchain.c b/reactos/dll/directx/d3d9/d3d9_swapchain.c index dc3acfc7a70..32217c0e5c4 100644 --- a/reactos/dll/directx/d3d9/d3d9_swapchain.c +++ b/reactos/dll/directx/d3d9/d3d9_swapchain.c @@ -249,3 +249,8 @@ VOID Direct3DSwapChain9_GetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, D3D { memcpy(pRamp, &pThisSwapChain->GammaRamp, sizeof(D3DGAMMARAMP)); } + +VOID Direct3DSwapChain9_SetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) +{ + UNIMPLEMENTED +} diff --git a/reactos/dll/directx/d3d9/d3d9_swapchain.h b/reactos/dll/directx/d3d9/d3d9_swapchain.h index 53546470b35..4314c725897 100644 --- a/reactos/dll/directx/d3d9/d3d9_swapchain.h +++ b/reactos/dll/directx/d3d9/d3d9_swapchain.h @@ -78,5 +78,6 @@ VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D HRESULT Direct3DSwapChain9_Init(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters); HRESULT Direct3DSwapChain9_Reset(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters); VOID Direct3DSwapChain9_GetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, D3DGAMMARAMP* pRamp); +VOID Direct3DSwapChain9_SetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp); #endif // _D3D9_SWAPCHAIN_H_