Module: wine Branch: master Commit: 0457b0c3466a92377a9662239bb34366e734456e URL: http://source.winehq.org/git/wine.git/?a=commit;h=0457b0c3466a92377a9662239b...
Author: Dmitry Timoshkov dmitry@codeweavers.com Date: Fri Feb 16 17:02:12 2007 +0800
gdi32: CreateBitmapIndirect should ignore the provided bm.bmWidthBytes.
---
dlls/gdi32/bitmap.c | 3 +++ dlls/gdi32/tests/bitmap.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 22384de..d16e70f 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -263,6 +263,9 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp ) return NULL; }
+ /* Windows ignores the provided bm.bmWidthBytes */ + bm.bmWidthBytes = BITMAP_GetWidthBytes( bm.bmWidth, bm.bmBitsPixel ); + /* Create the BITMAPOBJ */ bmpobj = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC, (HGDIOBJ *)&hbitmap, &bitmap_funcs ); diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index ee4abc3..99f2986 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -1637,6 +1637,7 @@ static void test_mono_1x1_bmp_dbg(HBITMAP hbmp, int line)
static void test_CreateBitmap(void) { + BITMAP bmp; HDC screenDC = GetDC(0); HDC hdc = CreateCompatibleDC(screenDC);
@@ -1684,6 +1685,19 @@ static void test_CreateBitmap(void)
DeleteDC(hdc); ReleaseDC(0, screenDC); + + /* show that Windows ignores the provided bm.bmWidthBytes */ + bmp.bmType = 0; + bmp.bmWidth = 1; + bmp.bmHeight = 1; + bmp.bmWidthBytes = 28; + bmp.bmPlanes = 1; + bmp.bmBitsPixel = 1; + bmp.bmBits = NULL; + bm = CreateBitmapIndirect(&bmp); + ok(bm != 0, "CreateBitmapIndirect error %u\n", GetLastError()); + test_mono_1x1_bmp(bm); + DeleteObject(bm); }
START_TEST(bitmap)