d3dx9: Do not ignore surface map failure in D3DXSaveSurfaceToFileInMemory().
Signed-off-by: Paul Gofman <gofmanp@gmail.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
61e7e6ec1b
commit
ce09011434
|
@ -2229,13 +2229,13 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
|
|||
if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */
|
||||
{
|
||||
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);
|
||||
IDirect3DSurface9_UnlockRect(src_surface);
|
||||
}
|
||||
}
|
||||
else /* Pixel format conversion */
|
||||
{
|
||||
const struct pixel_format_desc *src_format_desc, *dst_format_desc;
|
||||
|
@ -2266,12 +2266,14 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
|
|||
}
|
||||
|
||||
hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, src_rect, D3DLOCK_READONLY);
|
||||
if (SUCCEEDED(hr))
|
||||
if (FAILED(hr))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, dst_data);
|
||||
goto cleanup;
|
||||
}
|
||||
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);
|
||||
HeapFree(GetProcessHeap(), 0, dst_data);
|
||||
|
|
Loading…
Reference in New Issue