Commit 0457b0c3 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi32: CreateBitmapIndirect should ignore the provided bm.bmWidthBytes.

parent f9975b00
......@@ -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 );
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment