[PATCH 2/5] ddraw: Use wined3d_surface_get_pitch() to calculate dwLinearSize for compressed surfaces.

Henri Verbeet hverbeet at codeweavers.com
Wed Jun 11 04:55:43 CDT 2014


---
 dlls/ddraw/surface.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index a326404..caa1a5c 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -6118,11 +6118,8 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, s
             || wined3d_desc.format == WINED3DFMT_DXT3 || wined3d_desc.format == WINED3DFMT_DXT4
             || wined3d_desc.format == WINED3DFMT_DXT5)
     {
-        surface->surface_desc.dwFlags |= DDSD_LINEARSIZE;
-        if (wined3d_desc.format == WINED3DFMT_DXT1)
-            surface->surface_desc.u1.dwLinearSize = max(4, desc->dwWidth) * max(4, desc->dwHeight) / 2;
-        else
-            surface->surface_desc.u1.dwLinearSize = max(4, desc->dwWidth) * max(4, desc->dwHeight);
+        desc->dwFlags |= DDSD_LINEARSIZE;
+        desc->u1.dwLinearSize = wined3d_surface_get_pitch(wined3d_surface) * ((desc->dwHeight + 3) / 4);
     }
     else if (!(desc->dwFlags & DDSD_LPSURFACE))
     {
-- 
1.7.10.4




More information about the wine-patches mailing list