Stefan Dösinger : wined3d: Clean up IWineD3DSurface:: ReleaseDC.
Alexandre Julliard
julliard at winehq.org
Tue Sep 18 05:31:01 CDT 2007
Module: wine
Branch: master
Commit: 515ee4e89bb654d3668957135437f9cef0e8847b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=515ee4e89bb654d3668957135437f9cef0e8847b
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Sep 17 12:53:34 2007 +0200
wined3d: Clean up IWineD3DSurface::ReleaseDC.
---
dlls/wined3d/surface_gdi.c | 23 ++++++++++++++++++++++-
dlls/wined3d/wined3d_private.h | 1 -
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index 49f24c9..f5c5b48 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -1490,6 +1490,27 @@ const char* filename)
return WINED3D_OK;
}
+HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
+ IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
+
+ TRACE("(%p)->(%p)\n",This,hDC);
+
+ if (!(This->Flags & SFLAG_DCINUSE))
+ return WINED3DERR_INVALIDCALL;
+
+ if (This->hDC !=hDC) {
+ WARN("Application tries to release an invalid DC(%p), surface dc is %p\n", hDC, This->hDC);
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ /* we locked first, so unlock now */
+ IWineD3DSurface_UnlockRect(iface);
+
+ This->Flags &= ~SFLAG_DCINUSE;
+
+ return WINED3D_OK;
+}
+
/*****************************************************************************
* IWineD3DSurface::PrivateSetup, GDI version
*
@@ -1641,7 +1662,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineGDISurfaceImpl_LockRect,
IWineGDISurfaceImpl_UnlockRect,
IWineD3DSurfaceImpl_GetDC,
- IWineD3DSurfaceImpl_ReleaseDC,
+ IWineGDISurfaceImpl_ReleaseDC,
IWineGDISurfaceImpl_Flip,
IWineGDISurfaceImpl_Blt,
IWineD3DBaseSurfaceImpl_GetBltStatus,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4452274..66d8b42 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1174,7 +1174,6 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface);
HRESULT WINAPI IWineD3DSurfaceImpl_SetPixelFormat(IWineD3DSurface *iface, WINED3DFORMAT Format, BYTE *Surface, DWORD Size);
const void *WINAPI IWineD3DSurfaceImpl_GetData(IWineD3DSurface *iface);
HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC);
-HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC);
HRESULT WINAPI IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *SrcRect, DWORD Flags, WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter);
HRESULT WINAPI IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, IWineD3DSurface *Source, RECT *rsrc, DWORD trans);
More information about the wine-cvs
mailing list