[PATCH 7/8] gdi32: Calculate the stride from the image size.

Huw Davies huw at codeweavers.com
Mon Feb 13 08:08:04 CST 2017


This allows bitmaps to be created by D3DKMTCreateDCFromMemory() which have more freedom
in their choice of stride.

Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/gdi32/dibdrv/dc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 9bd263c..aee305f 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -154,7 +154,10 @@ static void init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, int stride,
 
 void init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits)
 {
-    init_dib_info( dib, &info->bmiHeader, get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount ),
+    int width_bytes = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
+    if (info->bmiHeader.biSizeImage)
+        width_bytes = info->bmiHeader.biSizeImage / abs( info->bmiHeader.biHeight );
+    init_dib_info( dib, &info->bmiHeader, width_bytes,
                    (const DWORD *)info->bmiColors, info->bmiColors, bits );
 }
 
-- 
2.10.2




More information about the wine-patches mailing list