wined3d: Simplify wined3d_surface_set_mem.

This commit is contained in:
Stefan Dösinger 2014-01-07 22:12:14 +01:00 committed by Alexandre Julliard
parent 2a012ba16f
commit 82666af87a
1 changed files with 19 additions and 44 deletions

View File

@ -2619,9 +2619,6 @@ HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem
return WINED3DERR_INVALIDCALL;
}
if (mem && mem != surface->user_memory)
{
/* Do I have to copy the old surface content? */
if (surface->flags & SFLAG_DIBSECTION)
{
DeleteDC(surface->hDC);
@ -2636,37 +2633,15 @@ HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem
wined3d_resource_free_sysmem(&surface->resource);
surface->resource.allocatedMemory = NULL;
}
surface->user_memory = mem;
surface->flags |= SFLAG_USERPTR;
/* Now the surface memory is most up do date. Invalidate drawable and texture. */
surface_validate_location(surface, SFLAG_INSYSMEM);
surface_invalidate_location(surface, ~SFLAG_INSYSMEM);
/* For client textures OpenGL has to be notified. */
if (surface->flags & SFLAG_CLIENT)
surface_release_client_storage(surface);
}
else if (surface->flags & SFLAG_USERPTR)
{
/* heap_memory should be NULL already. */
if (surface->resource.heap_memory)
ERR("User pointer surface has heap memory allocated.\n");
if (!mem)
{
surface->user_memory = NULL;
surface->flags &= ~(SFLAG_USERPTR | SFLAG_INSYSMEM);
if (surface->flags & SFLAG_CLIENT)
surface_release_client_storage(surface);
surface_prepare_system_memory(surface);
}
surface_validate_location(surface, SFLAG_INSYSMEM);
surface_invalidate_location(surface, ~SFLAG_INSYSMEM);
}
surface->pitch = pitch;