=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Don' t map the surface in getdc.

Alexandre Julliard julliard at winehq.org
Tue Jan 14 13:45:00 CST 2014


Module: wine
Branch: master
Commit: 96658847664ba76789ae811c24ca31b883b1d5fa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=96658847664ba76789ae811c24ca31b883b1d5fa

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Jan 14 13:59:24 2014 +0100

wined3d: Don't map the surface in getdc.

This avoids bouncing the content between the map binding and DIB.

---

 dlls/wined3d/surface.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ef91ebc..f59efb2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3219,7 +3219,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
 
 HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
 {
-    struct wined3d_map_desc map;
     HRESULT hr;
 
     TRACE("surface %p, dc %p.\n", surface, dc);
@@ -3245,14 +3244,6 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
             return WINED3DERR_INVALIDCALL;
     }
 
-    /* Map the surface. */
-    hr = wined3d_surface_map(surface, &map, NULL, 0);
-    if (FAILED(hr))
-    {
-        ERR("Map failed, hr %#x.\n", hr);
-        return hr;
-    }
-
     surface_load_location(surface, SFLAG_INDIB);
     surface_invalidate_location(surface, ~SFLAG_INDIB);
 
@@ -3294,6 +3285,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
     }
 
     surface->flags |= SFLAG_DCINUSE;
+    surface->resource.map_count++;
 
     *dc = surface->hDC;
     TRACE("Returning dc %p.\n", *dc);
@@ -3315,8 +3307,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
         return WINEDDERR_NODC;
     }
 
-    wined3d_surface_unmap(surface);
-
+    surface->resource.map_count--;
     surface->flags &= ~SFLAG_DCINUSE;
 
     if (surface->map_binding == SFLAG_INUSERMEM)




More information about the wine-cvs mailing list