wined3d: Give GDI surfaces their own release implementation.

This commit is contained in:
Stefan Dösinger 2007-09-17 15:04:46 +02:00 committed by Alexandre Julliard
parent 3f0ea3d082
commit 09b7d3bb44
2 changed files with 40 additions and 2 deletions

View File

@ -128,6 +128,45 @@ x11_copy_to_screen(IWineD3DSurfaceImpl *This,
}
}
/*****************************************************************************
* IWineD3DSurface::Release, GDI version
*
* In general a normal COM Release method, but the GDI version doesn't have
* to destroy all the GL things.
*
*****************************************************************************/
ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
ULONG ref = InterlockedDecrement(&This->resource.ref);
TRACE("(%p) : Releasing from %d\n", This, ref + 1);
if (ref == 0) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
TRACE("(%p) : cleaning up\n", This);
if(This->Flags & SFLAG_DIBSECTION) {
/* Release the DC */
SelectObject(This->hDC, This->dib.holdbitmap);
DeleteDC(This->hDC);
/* Release the DIB section */
DeleteObject(This->dib.DIBsection);
This->dib.bitmap_data = NULL;
This->resource.allocatedMemory = NULL;
}
if(This->Flags & SFLAG_USERPTR) IWineD3DSurface_SetMem(iface, NULL);
HeapFree(GetProcessHeap(), 0, This->palette9);
IWineD3DResourceImpl_CleanUp((IWineD3DResource *)iface);
if(iface == device->ddraw_primary)
device->ddraw_primary = NULL;
TRACE("(%p) Released\n", This);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*****************************************************************************
* IWineD3DSurface::PreLoad, GDI version
*
@ -1698,7 +1737,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
/* IUnknown */
IWineD3DBaseSurfaceImpl_QueryInterface,
IWineD3DBaseSurfaceImpl_AddRef,
IWineD3DSurfaceImpl_Release,
IWineGDISurfaceImpl_Release,
/* IWineD3DResource */
IWineD3DBaseSurfaceImpl_GetParent,
IWineD3DBaseSurfaceImpl_GetDevice,

View File

@ -1171,7 +1171,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format);
HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface);
ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface);
const void *WINAPI IWineD3DSurfaceImpl_GetData(IWineD3DSurface *iface);
HRESULT WINAPI IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface, RECT *DestRect, IWineD3DSurface *SrcSurface, RECT *SrcRect, DWORD Flags, WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter);