Henri Verbeet : wined3d: Use wined3d_texture_get_pitch() in surface_download_data().

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 11 09:59:45 CST 2016


Module: wine
Branch: master
Commit: ef040d71db045a13df0b3209f542ba4a50787a8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ef040d71db045a13df0b3209f542ba4a50787a8d

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Feb 10 19:29:58 2016 +0100

wined3d: Use wined3d_texture_get_pitch() in surface_download_data().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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




More information about the wine-cvs mailing list