Henri Verbeet : wined3d: Use the texture dimension helpers in surface_download_data().

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 6 11:12:03 CDT 2016


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Apr  5 18:24:20 2016 +0200

wined3d: Use the texture dimension helpers 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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 16d03e8..0055e62 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1054,8 +1054,8 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
         if (texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED)
         {
             const BYTE *src_data;
+            unsigned int h, y;
             BYTE *dst_data;
-            UINT y;
             /*
              * Some games (e.g. warhammer 40k) don't work properly with the odd pitches, preventing
              * the surface pitch from being used to box non-power2 textures. Instead we have to use a hack to
@@ -1104,7 +1104,8 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
             src_data = mem;
             dst_data = data.addr;
             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)
+            h = wined3d_texture_get_level_height(texture, surface->texture_level);
+            for (y = 0; y < h; ++y)
             {
                 memcpy(dst_data, src_data, dst_row_pitch);
                 src_data += src_row_pitch;




More information about the wine-cvs mailing list