Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/texture.c:
- { - IDirect3DSurface9_Release(src_surface); - goto exit; - } + hr = lock_surface(src_surface, NULL, &src_locked_rect, &tmp_surface, FALSE); + if (FAILED(hr)) + { + IDirect3DSurface9_Release(src_surface); + goto exit; + }
- IDirect3DTexture9_GetLevelDesc((IDirect3DTexture9 *)src_texture, i, &src_surface_desc); - SetRect(&src_rect, 0, 0, src_surface_desc.Width, src_surface_desc.Height); - set_d3dx_pixels(&src_pixels, src_locked_rect.pBits, src_locked_rect.Pitch, 0, src_palette, - src_surface_desc.Width, src_surface_desc.Height, 1, &src_rect); + IDirect3DTexture9_GetLevelDesc((IDirect3DTexture9 *)src_texture, i, &src_surface_desc); This is a bit awkward. For cube textures, this should be `IDirect3DCubeTexture9_GetLevelDesc((IDirect3DCubeTexture9 *)src_texture, ...`
In practice the two `GetLevelDesc()` methods match in position in the respective vtbls and signature, so this works, but it's still technically a "bad" cast and it looks suspicious at first glance. I'd prefer to do this "by the book" and duplicate the `GetLevelDesc()` call for the two cases. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7636#note_98845