From 8d930f6009bbdd45f62ed550b7aa67be77b36379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 1 Jul 2008 11:17:38 -0500 Subject: [PATCH] wined3d: Restore the gamma when destroying the swapchain. --- dlls/wined3d/device.c | 2 ++ dlls/wined3d/swapchain.c | 4 ++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 7 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7754e5028e6..d7e157d21e3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1599,6 +1599,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic object->wantsDepthStencilBuffer = FALSE; } + IWineD3DSwapChain_GetGammaRamp((IWineD3DSwapChain *) object, &object->orig_gamma); + TRACE("Created swapchain %p\n", object); TRACE("FrontBuf @ %p, BackBuf @ %p, DepthStencil %d\n",object->frontBuffer, object->backBuffer ? object->backBuffer[0] : NULL, object->wantsDepthStencilBuffer); return WINED3D_OK; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 5cc1c5941b7..e564a81dd39 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -88,6 +88,10 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface, D3DCB WINED3DDISPLAYMODE mode; int i; + TRACE("Destroying swapchain %p\n", iface); + + IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma); + /* release the ref to the front and back buffer parents */ if(This->frontBuffer) { IWineD3DSurface_SetContainer(This->frontBuffer, 0); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ae36ad1dbea..83955b90e9d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1698,6 +1698,7 @@ typedef struct IWineD3DSwapChainImpl WINED3DPRESENT_PARAMETERS presentParms; DWORD orig_width, orig_height; WINED3DFORMAT orig_fmt; + WINED3DGAMMARAMP orig_gamma; long prev_time, frames; /* Performance tracking */ unsigned int vSyncCounter;