From ef040d71db045a13df0b3209f542ba4a50787a8d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 10 Feb 2016 19:29:58 +0100 Subject: [PATCH] wined3d: Use wined3d_texture_get_pitch() in surface_download_data(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/surface.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b31e2ea4c89..820fbfa1bc5 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1330,14 +1330,15 @@ static void surface_download_data(struct wined3d_surface *surface, const struct } else { - unsigned int src_row_pitch, src_slice_pitch, dst_pitch = 0; + unsigned int dst_row_pitch, dst_slice_pitch; + unsigned int src_row_pitch, src_slice_pitch; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; void *mem; if (surface->flags & SFLAG_NONPOW2) { - dst_pitch = wined3d_surface_get_pitch(surface); + wined3d_texture_get_pitch(surface->container, surface->texture_level, &dst_row_pitch, &dst_slice_pitch); wined3d_format_calculate_pitch(format, surface->resource.device->surface_alignment, surface->pow2Width, surface->pow2Height, &src_row_pitch, &src_slice_pitch); mem = HeapAlloc(GetProcessHeap(), 0, src_slice_pitch); @@ -1425,12 +1426,12 @@ static void surface_download_data(struct wined3d_surface *surface, const struct * won't be released, and doesn't have to be re-read. */ src_data = mem; dst_data = data.addr; - TRACE("Repacking the surface data from pitch %u to pitch %u.\n", src_row_pitch, dst_pitch); + TRACE("Repacking the surface data from pitch %u to pitch %u.\n", src_row_pitch, dst_row_pitch); for (y = 0; y < surface->resource.height; ++y) { - memcpy(dst_data, src_data, dst_pitch); + memcpy(dst_data, src_data, dst_row_pitch); src_data += src_row_pitch; - dst_data += dst_pitch; + dst_data += dst_row_pitch; } HeapFree(GetProcessHeap(), 0, mem);