Matteo Bruni : d3dx9: Fix pitch passed to DXTn [de]compression functions.
Alexandre Julliard
julliard at winehq.org
Wed Oct 2 17:47:37 CDT 2019
Module: wine
Branch: master
Commit: 9069913dbba0914b80544ce4afb9e7285efad2a5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9069913dbba0914b80544ce4afb9e7285efad2a5
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Wed Oct 2 20:22:08 2019 +0200
d3dx9: Fix pitch passed to DXTn [de]compression functions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47862
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/surface.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index b47509aa38..29325d5c0a 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -1972,6 +1972,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
int i, int j, void *texel);
unsigned int x, y;
+ src_pitch = src_pitch * srcformatdesc->block_width / srcformatdesc->block_byte_count;
+
src_uncompressed = heap_alloc(src_size.width * src_size.height * sizeof(DWORD));
if (!src_uncompressed)
{
@@ -2003,8 +2005,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
DWORD *ptr = &src_uncompressed[y * src_size.width];
for (x = 0; x < src_size.width; ++x)
{
- fetch_dxt_texel(src_pitch / sizeof(DWORD), src_memory,
- x + src_rect->left, y + src_rect->top, ptr);
+ fetch_dxt_texel(src_pitch, src_memory, x + src_rect->left, y + src_rect->top, ptr);
++ptr;
}
}
@@ -2080,7 +2081,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
ERR("Unexpected destination compressed format %u.\n", surfdesc.Format);
}
tx_compress_dxtn(4, dst_size_aligned.width, dst_size_aligned.height,
- dst_uncompressed, gl_format, lockrect.pBits, lockrect.Pitch);
+ dst_uncompressed, gl_format, lockrect.pBits,
+ lockrect.Pitch * destformatdesc->block_width / destformatdesc->block_byte_count);
heap_free(dst_uncompressed);
}
}
More information about the wine-cvs
mailing list