wined3d: Don't map the surface in getdc.

This avoids bouncing the content between the map binding and DIB.
This commit is contained in:
Stefan Dösinger 2014-01-14 13:59:24 +01:00 committed by Alexandre Julliard
parent adf0ab2ad8
commit 9665884766
1 changed files with 2 additions and 11 deletions

View File

@ -3219,7 +3219,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
{ {
struct wined3d_map_desc map;
HRESULT hr; HRESULT hr;
TRACE("surface %p, dc %p.\n", surface, dc); 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; 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_load_location(surface, SFLAG_INDIB);
surface_invalidate_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->flags |= SFLAG_DCINUSE;
surface->resource.map_count++;
*dc = surface->hDC; *dc = surface->hDC;
TRACE("Returning dc %p.\n", *dc); TRACE("Returning dc %p.\n", *dc);
@ -3315,8 +3307,7 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
return WINEDDERR_NODC; return WINEDDERR_NODC;
} }
wined3d_surface_unmap(surface); surface->resource.map_count--;
surface->flags &= ~SFLAG_DCINUSE; surface->flags &= ~SFLAG_DCINUSE;
if (surface->map_binding == SFLAG_INUSERMEM) if (surface->map_binding == SFLAG_INUSERMEM)