Module: wine Branch: master Commit: 0bec2f7965db53ca369aaa0b84d07fa73d626d5c URL: http://source.winehq.org/git/wine.git/?a=commit;h=0bec2f7965db53ca369aaa0b84...
Author: Huw Davies huw@codeweavers.com Date: Mon Feb 13 14:08:04 2017 +0000
gdi32: Calculate the stride from the image size.
This allows bitmaps to be created by D3DKMTCreateDCFromMemory() which have more freedom in their choice of stride.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 ); }