wined3d: Use the pointer returned by map in wined3d_surface_getdc.

This commit is contained in:
Stefan Dösinger 2013-11-25 23:41:12 +01:00 committed by Alexandre Julliard
parent 038e45c662
commit eb446e8640
2 changed files with 7 additions and 7 deletions

View File

@ -3324,11 +3324,10 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
ERR("Map failed, hr %#x.\n", hr);
return hr;
}
surface->getdc_map_mem = map.data;
/* Sync the DIB with the PBO. This can't be done earlier because Map()
* activates the allocatedMemory. */
if (surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM))
memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, surface->resource.size);
if (surface->dib.bitmap_data != surface->getdc_map_mem)
memcpy(surface->dib.bitmap_data, surface->getdc_map_mem, surface->resource.size);
if (surface->resource.format->id == WINED3DFMT_P8_UINT
|| surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
@ -3389,11 +3388,11 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
return WINEDDERR_NODC;
}
/* Copy the contents of the DIB over to the PBO. */
if ((surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM)) && surface->resource.allocatedMemory)
memcpy(surface->resource.allocatedMemory, surface->dib.bitmap_data, surface->resource.size);
if (surface->dib.bitmap_data != surface->getdc_map_mem)
memcpy(surface->getdc_map_mem, surface->dib.bitmap_data, surface->resource.size);
/* We locked first, so unlock now. */
surface->getdc_map_mem = NULL;
wined3d_surface_unmap(surface);
surface->flags &= ~SFLAG_DCINUSE;

View File

@ -2204,6 +2204,7 @@ struct wined3d_surface
/* For GetDC */
struct wined3d_surface_dib dib;
HDC hDC;
void *getdc_map_mem;
/* Color keys for DDraw */
struct wined3d_color_key dst_blt_color_key;