Commit ce090114 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3dx9: Do not ignore surface map failure in D3DXSaveSurfaceToFileInMemory().

parent 61e7e6ec
...@@ -2229,12 +2229,12 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE ...@@ -2229,12 +2229,12 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */ if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */
{ {
hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY);
if (SUCCEEDED(hr)) if (FAILED(hr))
{ goto cleanup;
IWICBitmapFrameEncode_WritePixels(frame, height,
locked_rect.Pitch, height * locked_rect.Pitch, locked_rect.pBits); IWICBitmapFrameEncode_WritePixels(frame, height,
IDirect3DSurface9_UnlockRect(src_surface); locked_rect.Pitch, height * locked_rect.Pitch, locked_rect.pBits);
} IDirect3DSurface9_UnlockRect(src_surface);
} }
else /* Pixel format conversion */ else /* Pixel format conversion */
{ {
...@@ -2266,12 +2266,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE ...@@ -2266,12 +2266,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
} }
hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY); hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY);
if (SUCCEEDED(hr)) if (FAILED(hr))
{ {
convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, &size, src_format_desc, HeapFree(GetProcessHeap(), 0, dst_data);
dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL); goto cleanup;
IDirect3DSurface9_UnlockRect(src_surface);
} }
convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, &size, src_format_desc,
dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL);
IDirect3DSurface9_UnlockRect(src_surface);
IWICBitmapFrameEncode_WritePixels(frame, height, dst_pitch, dst_pitch * height, dst_data); IWICBitmapFrameEncode_WritePixels(frame, height, dst_pitch, dst_pitch * height, dst_data);
HeapFree(GetProcessHeap(), 0, dst_data); HeapFree(GetProcessHeap(), 0, dst_data);
......
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