[PATCH 1/7] wined3d: Use the texture dimension helpers in surface_download_data().

Henri Verbeet hverbeet at codeweavers.com
Tue Apr 5 11:24:20 CDT 2016


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 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;
-- 
2.1.4




More information about the wine-patches mailing list