mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-07 19:55:04 +00:00
d3dx9: Fix destination rectangles passed from D3DXLoadSurfaceFromMemory() to d3dx_load_image_from_memory().
d3dx_load_image_from_memory() expects the address of the dst_memory argument to represent the top left corner of the surface. If a surface is locked using a rectangle that doesn't start at the top left corner of the surface, the rectangle we pass to d3dx_load_image_from_memory() needs to be adjusted so that it properly represents the locked area. Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
This commit is contained in:
parent
e6f79a8059
commit
f9676836d6
|
@ -2116,8 +2116,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
|
|||
D3DFORMAT src_format, UINT src_pitch, const PALETTEENTRY *src_palette, const RECT *src_rect,
|
||||
DWORD filter, D3DCOLOR color_key)
|
||||
{
|
||||
RECT dst_rect_temp, dst_rect_aligned, dst_locked_rect, dst_locked_rect_aligned;
|
||||
const struct pixel_format_desc *srcformatdesc, *destformatdesc;
|
||||
RECT dst_rect_temp, dst_rect_aligned;
|
||||
IDirect3DSurface9 *surface;
|
||||
D3DSURFACE_DESC surfdesc;
|
||||
D3DLOCKED_RECT lockrect;
|
||||
|
@ -2192,8 +2192,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
|
|||
if (FAILED(hr = lock_surface(dst_surface, &dst_rect_aligned, &lockrect, &surface, TRUE)))
|
||||
return hr;
|
||||
|
||||
hr = d3dx_load_image_from_memory(lockrect.pBits, lockrect.Pitch, destformatdesc, dst_palette, dst_rect,
|
||||
&dst_rect_aligned, src_memory, src_pitch, srcformatdesc, src_palette, src_rect, filter, color_key);
|
||||
dst_locked_rect_aligned = dst_rect_aligned;
|
||||
dst_locked_rect = *dst_rect;
|
||||
OffsetRect(&dst_locked_rect_aligned, -dst_rect_aligned.left, -dst_rect_aligned.top);
|
||||
OffsetRect(&dst_locked_rect, -dst_rect_aligned.left, -dst_rect_aligned.top);
|
||||
hr = d3dx_load_image_from_memory(lockrect.pBits, lockrect.Pitch, destformatdesc, dst_palette, &dst_locked_rect,
|
||||
&dst_locked_rect_aligned, src_memory, src_pitch, srcformatdesc, src_palette, src_rect, filter, color_key);
|
||||
if (FAILED(hr))
|
||||
WARN("d3dx_load_image_from_memory failed with hr %#lx\n", hr);
|
||||
|
||||
|
|
|
@ -1697,7 +1697,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
|
|||
* Bottom left of green block, should still be black from prior
|
||||
* operation.
|
||||
*/
|
||||
check_readback_pixel_4bpp(&surface_rb, 4, 3, 0xff000000, TRUE);
|
||||
check_readback_pixel_4bpp(&surface_rb, 4, 3, 0xff000000, FALSE);
|
||||
|
||||
release_surface_readback(&surface_rb);
|
||||
|
||||
|
|
Loading…
Reference in a new issue