Commit ef040d71 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use wined3d_texture_get_pitch() in surface_download_data().

parent fdecf9e4
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment