From 23a377f02b82a39605cc0735130b315a4c3b7bf1 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 28 Apr 2010 00:08:48 +0200 Subject: [PATCH] wined3d: Simply pass an IWineD3DSurfaceImpl pointer to surface_init_sysmem(). --- dlls/wined3d/device.c | 2 +- dlls/wined3d/surface.c | 25 +++++++++++++------------ dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 062fb204d7..a2b2c3e311 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -6234,7 +6234,7 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES /* Put all surfaces into sysmem - the drawable might disappear if the backbuffer was rendered * to a FBO */ - if(!surface_init_sysmem((IWineD3DSurface *) surface)) + if (!surface_init_sysmem(surface)) { return E_OUTOFMEMORY; } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index fcdfec8fb6..d3fe566d32 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1141,27 +1141,26 @@ static void surface_remove_pbo(IWineD3DSurfaceImpl *This, const struct wined3d_g This->Flags &= ~SFLAG_PBO; } -BOOL surface_init_sysmem(IWineD3DSurface *iface) +BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - - if(!This->resource.allocatedMemory) + if (!surface->resource.allocatedMemory) { - This->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + RESOURCE_ALIGNMENT); - if(!This->resource.heapMemory) + surface->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + surface->resource.size + RESOURCE_ALIGNMENT); + if (!surface->resource.heapMemory) { ERR("Out of memory\n"); return FALSE; } - This->resource.allocatedMemory = - (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + surface->resource.allocatedMemory = + (BYTE *)(((ULONG_PTR)surface->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); } else { - memset(This->resource.allocatedMemory, 0, This->resource.size); + memset(surface->resource.allocatedMemory, 0, surface->resource.size); } - IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE); + IWineD3DSurface_ModifyLocation((IWineD3DSurface *)surface, SFLAG_INSYSMEM, TRUE); return TRUE; } @@ -1186,8 +1185,10 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) { * or the depth stencil into an FBO the texture or render buffer will be removed * and all flags get lost */ - surface_init_sysmem(iface); - } else { + surface_init_sysmem(This); + } + else + { /* Load the surface into system memory */ IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL); IWineD3DSurface_ModifyLocation(iface, SFLAG_INDRAWABLE, FALSE); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 70ecb2282c..3e54ad8a5c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1873,7 +1873,7 @@ typedef struct IWineD3DBaseTextureClass } IWineD3DBaseTextureClass; void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; -BOOL surface_init_sysmem(IWineD3DSurface *iface) DECLSPEC_HIDDEN; +BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN; void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;