Connor McAdams : d3dx9: Cleanup texture value argument handling in D3DXCreateTextureFromFileInMemoryEx().
Module: wine Branch: master Commit: be746bee64b76931240429ad64b6fdbf79ec9733 URL: https://gitlab.winehq.org/wine/wine/-/commit/be746bee64b76931240429ad64b6fdb... Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Wed Jun 5 11:29:31 2024 -0400 d3dx9: Cleanup texture value argument handling in D3DXCreateTextureFromFileInMemoryEx(). Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/d3dx9_36/texture.c | 42 +++++++----------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 12702c0ca49..f8b4a7795f7 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -598,43 +598,15 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi d3dximage_info_from_d3dx_image(&imginfo, &image); /* handle default values */ - if (width == 0 || width == D3DX_DEFAULT_NONPOW2) - width = imginfo.Width; - - if (height == 0 || height == D3DX_DEFAULT_NONPOW2) - height = imginfo.Height; - - if (width == D3DX_DEFAULT) - width = make_pow2(imginfo.Width); - - if (height == D3DX_DEFAULT) - height = make_pow2(imginfo.Height); - - if (format == D3DFMT_UNKNOWN || format == D3DX_DEFAULT) - format = imginfo.Format; - else - format_specified = TRUE; - - if (width == D3DX_FROM_FILE) - { - width = imginfo.Width; - } + if (!width || width == D3DX_DEFAULT_NONPOW2 || width == D3DX_FROM_FILE || width == D3DX_DEFAULT) + width = (width == D3DX_DEFAULT) ? make_pow2(imginfo.Width) : imginfo.Width; + if (!height || height == D3DX_DEFAULT_NONPOW2 || height == D3DX_FROM_FILE || height == D3DX_DEFAULT) + height = (height == D3DX_DEFAULT) ? make_pow2(imginfo.Height) : imginfo.Height; - if (height == D3DX_FROM_FILE) - { - height = imginfo.Height; - } - - if (format == D3DFMT_FROM_FILE) - { + format_specified = (format != D3DFMT_UNKNOWN && format != D3DX_DEFAULT); + if (format == D3DFMT_FROM_FILE || format == D3DFMT_UNKNOWN || format == D3DX_DEFAULT) format = imginfo.Format; - } - - if (miplevels == D3DX_FROM_FILE) - { - miplevels = imginfo.MipLevels; - } - + miplevels = (miplevels == D3DX_FROM_FILE) ? imginfo.MipLevels : miplevels; /* Fix up texture creation parameters. */ hr = D3DXCheckTextureRequirements(device, &width, &height, &miplevels, usage, &format, pool);
participants (1)
-
Alexandre Julliard