wined3d: Use wined3d_texture_get_pitch() in surface_download_data().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Henri Verbeet 2016-02-10 19:29:58 +01:00 committed by Alexandre Julliard
parent fdecf9e452
commit ef040d71db
1 changed files with 6 additions and 5 deletions

View File

@ -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);