[PATCH 3/5] wined3d: Use wined3d_texture_get_pitch() in surface_download_data().
Henri Verbeet
hverbeet at codeweavers.com
Wed Feb 10 12:29:58 CST 2016
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
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 b31e2ea..820fbfa 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);
--
2.1.4
More information about the wine-patches
mailing list