diff --git a/reactos/dll/directx/d3d9/d3d9_device.c b/reactos/dll/directx/d3d9/d3d9_device.c index d08d1bb702f..dfb31acfdb4 100644 --- a/reactos/dll/directx/d3d9/d3d9_device.c +++ b/reactos/dll/directx/d3d9/d3d9_device.c @@ -505,9 +505,50 @@ VOID WINAPI IDirect3DDevice9Base_SetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwa UNIMPLEMENTED } +/*++ +* @name IDirect3DDevice9::GetGammaRamp +* @implemented +* +* The function IDirect3DDevice9Base_GetGammaRamp retrieves 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 D3DGAMMARAMP* pRamp +* Pointer to a D3DGAMMARAMP to receive the gamma correction ramp values. +* +*/ VOID WINAPI IDirect3DDevice9Base_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, 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_GetGammaRamp(pSwapChain_INT, pRamp); + + UNLOCK_D3DDEVICE9(); } /*++ diff --git a/reactos/dll/directx/d3d9/d3d9_swapchain.c b/reactos/dll/directx/d3d9/d3d9_swapchain.c index d64ec3378b9..dc3acfc7a70 100644 --- a/reactos/dll/directx/d3d9/d3d9_swapchain.c +++ b/reactos/dll/directx/d3d9/d3d9_swapchain.c @@ -18,7 +18,7 @@ #define UNLOCK_D3DDEVICE9() D3D9BaseObject_UnlockDevice(&This->BaseObject) /* Convert a IDirect3DSwapChain9 pointer safely to the internal implementation struct */ -static LPDIRECT3DSWAPCHAIN9_INT IDirect3DSwapChain9ToImpl(LPDIRECT3DSWAPCHAIN9 iface) +LPDIRECT3DSWAPCHAIN9_INT IDirect3DSwapChain9ToImpl(LPDIRECT3DSWAPCHAIN9 iface) { if (NULL == iface) return NULL; @@ -244,3 +244,8 @@ HRESULT Direct3DSwapChain9_Reset(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRES // TODO: Do all the dirty work... return D3D_OK; } + +VOID Direct3DSwapChain9_GetGammaRamp(Direct3DSwapChain9_INT* pThisSwapChain, D3DGAMMARAMP* pRamp) +{ + memcpy(pRamp, &pThisSwapChain->GammaRamp, sizeof(D3DGAMMARAMP)); +} diff --git a/reactos/dll/directx/d3d9/d3d9_swapchain.h b/reactos/dll/directx/d3d9/d3d9_swapchain.h index c6e76095fdc..53546470b35 100644 --- a/reactos/dll/directx/d3d9/d3d9_swapchain.h +++ b/reactos/dll/directx/d3d9/d3d9_swapchain.h @@ -68,14 +68,15 @@ typedef struct _Direct3DSwapChain9_INT /* 0x01f4 */ D3DSWAPEFFECT SwapEffect; /* 0x01f8 */ DWORD dwUnknown01f8; /* 0x01fc */ DWORD dwUnknown01fc; -/* 0x0200 */ DDGAMMARAMP GammaRamp; +/* 0x0200 */ D3DGAMMARAMP GammaRamp; } Direct3DSwapChain9_INT, FAR* LPDIRECT3DSWAPCHAIN9_INT; - +LPDIRECT3DSWAPCHAIN9_INT IDirect3DSwapChain9ToImpl(LPDIRECT3DSWAPCHAIN9 iface); Direct3DSwapChain9_INT* CreateDirect3DSwapChain9(enum REF_TYPE RefType, struct _Direct3DDevice9_INT* pBaseDevice, DWORD ChainIndex); VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT* pThisSwapChain, D3DPRESENT_PARAMETERS* pPresentationParameters); 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); #endif // _D3D9_SWAPCHAIN_H_