From ced9d2e5e64407781a03c6e3e619fc36ecee4d45 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 10 Feb 2016 02:05:11 +0100
Subject: Revert "wined3d: Store custom pitches in the texture instead of the
 surface."

This partially reverts commit 195d16c8267fcd5085048b3513571e2fee0eb548.
---
 dlls/wined3d/surface.c         | 10 ++++++----
 dlls/wined3d/texture.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5182b29..0a8509c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1863,7 +1863,8 @@ static inline unsigned short float_32_to_16(const float *in)
     return ret;
 }
 
-HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
+HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
+        const struct wined3d_gl_info *gl_info, unsigned int pitch)
 {
     struct wined3d_resource *texture_resource = &surface->container->resource;
     unsigned int width, height;
@@ -1907,19 +1908,20 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struc
         surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
         valid_location = WINED3D_LOCATION_USER_MEMORY;
     }
+    surface->pitch = pitch;
     surface->resource.format = texture_resource->format;
     surface->resource.multisample_type = texture_resource->multisample_type;
     surface->resource.multisample_quality = texture_resource->multisample_quality;
-    if (surface->container->row_pitch)
+    if (surface->pitch)
     {
-        surface->resource.size = height * surface->container->row_pitch;
+        surface->resource.size = height * surface->pitch;
     }
     else
     {
         /* User memory surfaces don't have the regular surface alignment. */
         surface->resource.size = wined3d_format_calculate_size(texture_resource->format,
                 1, width, height, 1);
-        surface->container->row_pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
+        surface->pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
     }
 
     /* The format might be changed to a format that needs conversion.
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 8fe6251..f0ed152 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -684,7 +684,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
             && !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
         texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
 
-    return wined3d_surface_update_desc(surface, gl_info);
+    return wined3d_surface_update_desc(surface, gl_info, pitch);
 }
 
 void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 712267c..1cf309c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2498,6 +2498,7 @@ struct wined3d_surface
 
     DWORD flags;
 
+    UINT pitch;
     UINT pow2Width;
     UINT pow2Height;
 
@@ -2575,7 +2576,7 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target,
 void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
 HRESULT wined3d_surface_unmap(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
+        const struct wined3d_gl_info *gl_info, unsigned int pitch) DECLSPEC_HIDDEN;
 HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
         struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
 void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
-- 
2.7.1

