If a FOURCC surface specifies DDSD_PITCH, use that instead of
authorMatthew Mastracci <matt@aclaro.com>
Mon, 21 Mar 2005 10:28:09 +0000 (10:28 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 21 Mar 2005 10:28:09 +0000 (10:28 +0000)
dwLinearSize.

dlls/ddraw/dsurface/dib.c

index c0eafd44f5548db71bf3e58554612ac4d84adac7..b462c668593950a62cfbf7124ff6fa4a66ace09e 100644 (file)
@@ -255,7 +255,8 @@ HRESULT DIB_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
 
        This->surface_desc.dwFlags |= DDSD_LPSURFACE;
 
-       if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) {
+       /* Ensure that DDSD_PITCH is respected for DDPF_FOURCC surfaces too */
+       if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC && !(This->surface_desc.dwFlags & DDSD_PITCH)) {
            This->surface_desc.lpSurface
                = VirtualAlloc(NULL, This->surface_desc.u1.dwLinearSize, MEM_COMMIT, PAGE_READWRITE);
            This->surface_desc.dwFlags |= DDSD_LINEARSIZE;