Commit eb446e86 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Use the pointer returned by map in wined3d_surface_getdc.

parent 038e45c6
...@@ -3324,11 +3324,10 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) ...@@ -3324,11 +3324,10 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
ERR("Map failed, hr %#x.\n", hr); ERR("Map failed, hr %#x.\n", hr);
return hr; return hr;
} }
surface->getdc_map_mem = map.data;
/* Sync the DIB with the PBO. This can't be done earlier because Map() if (surface->dib.bitmap_data != surface->getdc_map_mem)
* activates the allocatedMemory. */ memcpy(surface->dib.bitmap_data, surface->getdc_map_mem, surface->resource.size);
if (surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM))
memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, surface->resource.size);
if (surface->resource.format->id == WINED3DFMT_P8_UINT if (surface->resource.format->id == WINED3DFMT_P8_UINT
|| surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) || surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
...@@ -3389,11 +3388,11 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) ...@@ -3389,11 +3388,11 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
return WINEDDERR_NODC; return WINEDDERR_NODC;
} }
/* Copy the contents of the DIB over to the PBO. */ if (surface->dib.bitmap_data != surface->getdc_map_mem)
if ((surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM)) && surface->resource.allocatedMemory) memcpy(surface->getdc_map_mem, surface->dib.bitmap_data, surface->resource.size);
memcpy(surface->resource.allocatedMemory, surface->dib.bitmap_data, surface->resource.size);
/* We locked first, so unlock now. */ /* We locked first, so unlock now. */
surface->getdc_map_mem = NULL;
wined3d_surface_unmap(surface); wined3d_surface_unmap(surface);
surface->flags &= ~SFLAG_DCINUSE; surface->flags &= ~SFLAG_DCINUSE;
......
...@@ -2204,6 +2204,7 @@ struct wined3d_surface ...@@ -2204,6 +2204,7 @@ struct wined3d_surface
/* For GetDC */ /* For GetDC */
struct wined3d_surface_dib dib; struct wined3d_surface_dib dib;
HDC hDC; HDC hDC;
void *getdc_map_mem;
/* Color keys for DDraw */ /* Color keys for DDraw */
struct wined3d_color_key dst_blt_color_key; struct wined3d_color_key dst_blt_color_key;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment