[PATCH 4/5] wined3d: Don't free the dib section in wined3d_surface_set_mem.

Stefan Dösinger stefan at codeweavers.com
Fri Dec 13 05:30:15 CST 2013


DIBs and user pointers are no longer mutually exclusive. In theory the
pitch can be changed in ddraw, but only together with the width, which
calls wined3d_surface_update_desc, which will recreate the DIB.

Note that getdc on a surface with a custom pitch still does not work
after this patch. Even though the DIB is created with the correct size,
surface->resource.size does not have the correct value, so the
DIB<->user memory copy in getdc / releasedc does not copy the data
correctly. This will be fixed in a separate patchset.
---
 dlls/wined3d/surface.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 75acdd6..4eb37ba 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2630,17 +2630,7 @@ HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem
 
     if (mem && mem != surface->user_memory)
     {
-        /* Do I have to copy the old surface content? */
-        if (surface->flags & SFLAG_DIBSECTION)
-        {
-            DeleteDC(surface->hDC);
-            DeleteObject(surface->dib.DIBsection);
-            surface->dib.bitmap_data = NULL;
-            surface->resource.allocatedMemory = NULL;
-            surface->hDC = NULL;
-            surface->flags &= ~SFLAG_DIBSECTION;
-        }
-        else if (!(surface->flags & SFLAG_USERPTR))
+        if (!(surface->flags & SFLAG_USERPTR))
         {
             wined3d_resource_free_sysmem(&surface->resource);
             surface->resource.allocatedMemory = NULL;
-- 
1.8.3.2




More information about the wine-patches mailing list