"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/d3dx9_36/surface.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

surface.c  (wine-5.12.tar.xz):surface.c  (wine-5.13.tar.xz)
skipping to change at line 2143 skipping to change at line 2143
* RETURNS * RETURNS
* Success: D3D_OK * Success: D3D_OK
* Failure: D3DERR_INVALIDCALL, if pDestSurface or pSrcSurface is NULL * Failure: D3DERR_INVALIDCALL, if pDestSurface or pSrcSurface is NULL
* D3DXERR_INVALIDDATA, if one of the surfaces is not lockable * D3DXERR_INVALIDDATA, if one of the surfaces is not lockable
* *
*/ */
HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface,
const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface,
const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3D COLOR color_key) const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3D COLOR color_key)
{ {
const struct pixel_format_desc *src_format_desc, *dst_format_desc;
D3DSURFACE_DESC src_desc, dst_desc;
struct volume src_size, dst_size;
IDirect3DSurface9 *temp_surface; IDirect3DSurface9 *temp_surface;
D3DTEXTUREFILTERTYPE d3d_filter; D3DTEXTUREFILTERTYPE d3d_filter;
IDirect3DDevice9 *device; IDirect3DDevice9 *device;
D3DSURFACE_DESC src_desc;
D3DLOCKED_RECT lock; D3DLOCKED_RECT lock;
RECT dst_rect_temp;
HRESULT hr; HRESULT hr;
RECT s; RECT s;
TRACE("dst_surface %p, dst_palette %p, dst_rect %s, src_surface %p, " TRACE("dst_surface %p, dst_palette %p, dst_rect %s, src_surface %p, "
"src_palette %p, src_rect %s, filter %#x, color_key 0x%08x.\n", "src_palette %p, src_rect %s, filter %#x, color_key 0x%08x.\n",
dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_surface, dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_surface,
src_palette, wine_dbgstr_rect(src_rect), filter, color_key); src_palette, wine_dbgstr_rect(src_rect), filter, color_key);
if (!dst_surface || !src_surface) if (!dst_surface || !src_surface)
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
IDirect3DSurface9_GetDesc(src_surface, &src_desc);
src_format_desc = get_format_info(src_desc.Format);
if (!src_rect)
{
SetRect(&s, 0, 0, src_desc.Width, src_desc.Height);
src_rect = &s;
}
else if (src_rect->left == src_rect->right || src_rect->top == src_rect->bot
tom)
{
WARN("Empty src_rect specified.\n");
return filter == D3DX_FILTER_NONE ? D3D_OK : E_FAIL;
}
else if (src_rect->left > src_rect->right || src_rect->right > src_desc.Widt
h
|| src_rect->left < 0 || src_rect->left > src_desc.Width
|| src_rect->top > src_rect->bottom || src_rect->bottom > src_desc.H
eight
|| src_rect->top < 0 || src_rect->top > src_desc.Height)
{
WARN("Invalid src_rect specified.\n");
return D3DERR_INVALIDCALL;
}
src_size.width = src_rect->right - src_rect->left;
src_size.height = src_rect->bottom - src_rect->top;
src_size.depth = 1;
IDirect3DSurface9_GetDesc(dst_surface, &dst_desc);
dst_format_desc = get_format_info(dst_desc.Format);
if (!dst_rect)
{
SetRect(&dst_rect_temp, 0, 0, dst_desc.Width, dst_desc.Height);
dst_rect = &dst_rect_temp;
}
else if (dst_rect->left == dst_rect->right || dst_rect->top == dst_rect->bot
tom)
{
WARN("Empty dst_rect specified.\n");
return filter == D3DX_FILTER_NONE ? D3D_OK : E_FAIL;
}
else if (dst_rect->left > dst_rect->right || dst_rect->right > dst_desc.Widt
h
|| dst_rect->left < 0 || dst_rect->left > dst_desc.Width
|| dst_rect->top > dst_rect->bottom || dst_rect->bottom > dst_desc.H
eight
|| dst_rect->top < 0 || dst_rect->top > dst_desc.Height)
{
WARN("Invalid dst_rect specified.\n");
return D3DERR_INVALIDCALL;
}
dst_size.width = dst_rect->right - dst_rect->left;
dst_size.height = dst_rect->bottom - dst_rect->top;
dst_size.depth = 1;
if (!dst_palette && !src_palette && !color_key) if (!dst_palette && !src_palette && !color_key)
{ {
switch (filter) if (src_desc.Format == dst_desc.Format
&& dst_size.width == src_size.width
&& dst_size.height == src_size.height
&& color_key == 0
&& !(src_rect->left & (src_format_desc->block_width - 1))
&& !(src_rect->top & (src_format_desc->block_height - 1))
&& !(dst_rect->left & (dst_format_desc->block_width - 1))
&& !(dst_rect->top & (dst_format_desc->block_height - 1)))
{
d3d_filter = D3DTEXF_NONE;
}
else
{ {
case D3DX_FILTER_NONE: switch (filter)
d3d_filter = D3DTEXF_NONE; {
break; case D3DX_FILTER_NONE:
d3d_filter = D3DTEXF_NONE;
case D3DX_FILTER_POINT: break;
d3d_filter = D3DTEXF_POINT;
break; case D3DX_FILTER_POINT:
d3d_filter = D3DTEXF_POINT;
case D3DX_FILTER_LINEAR: break;
d3d_filter = D3DTEXF_LINEAR;
break; case D3DX_FILTER_LINEAR:
d3d_filter = D3DTEXF_LINEAR;
default: break;
d3d_filter = ~0u;
break; default:
d3d_filter = D3DTEXF_FORCE_DWORD;
break;
}
} }
if (d3d_filter != ~0u) if (d3d_filter != D3DTEXF_FORCE_DWORD)
{ {
IDirect3DSurface9_GetDevice(src_surface, &device); IDirect3DSurface9_GetDevice(src_surface, &device);
hr = IDirect3DDevice9_StretchRect(device, src_surface, src_rect, dst _surface, dst_rect, d3d_filter); hr = IDirect3DDevice9_StretchRect(device, src_surface, src_rect, dst _surface, dst_rect, d3d_filter);
IDirect3DDevice9_Release(device); IDirect3DDevice9_Release(device);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
return D3D_OK; return D3D_OK;
} }
} }
IDirect3DSurface9_GetDesc(src_surface, &src_desc);
if (!src_rect)
{
SetRect(&s, 0, 0, src_desc.Width, src_desc.Height);
src_rect = &s;
}
if (FAILED(lock_surface(src_surface, NULL, &lock, &temp_surface, FALSE))) if (FAILED(lock_surface(src_surface, NULL, &lock, &temp_surface, FALSE)))
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
hr = D3DXLoadSurfaceFromMemory(dst_surface, dst_palette, dst_rect, lock.pBit s, hr = D3DXLoadSurfaceFromMemory(dst_surface, dst_palette, dst_rect, lock.pBit s,
src_desc.Format, lock.Pitch, src_palette, src_rect, filter, color_ke y); src_desc.Format, lock.Pitch, src_palette, src_rect, filter, color_ke y);
if (FAILED(unlock_surface(src_surface, NULL, temp_surface, FALSE))) if (FAILED(unlock_surface(src_surface, NULL, temp_surface, FALSE)))
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
return hr; return hr;
 End of changes. 8 change blocks. 
26 lines changed or deleted 91 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)