gdi32: Return the original brush data in GetObject.

This commit is contained in:
Alexandre Julliard 2011-11-03 20:18:59 +01:00
parent a16dbbe3d8
commit b47debddf5
2 changed files with 10 additions and 11 deletions

View File

@ -161,7 +161,6 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
case BS_PATTERN:
ptr->bitmap = BITMAP_CopyBitmap( (HBITMAP)ptr->logbrush.lbHatch );
if (!ptr->bitmap) goto error;
ptr->logbrush.lbHatch = (ULONG_PTR)ptr->bitmap;
ptr->logbrush.lbColor = 0;
break;
@ -176,7 +175,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
if (!ptr->info) goto error;
ptr->bits.ptr = (char *)ptr->info + bitmap_info_size( ptr->info, ptr->usage );
ptr->logbrush.lbStyle = BS_DIBPATTERN;
ptr->logbrush.lbHatch = (ULONG_PTR)ptr->info;
ptr->logbrush.lbColor = 0;
break;
case BS_DIBPATTERN8X8:
@ -446,7 +445,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if(pattern_dev == dc->dibdrv)
pattern_dev = GET_NEXT_PHYSDEV( physdev, pSelectBrush );
BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, pattern_dev );
BITMAP_SetOwnerDC( bitmap, pattern_dev );
}
info = brush->info;

View File

@ -100,7 +100,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
todo_wine ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
DeleteObject( brush );
br.lbStyle = BS_PATTERN8X8;
@ -113,7 +113,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
todo_wine ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
ret = GetObjectW( bitmap, sizeof(dib), &dib );
ok( ret == sizeof(dib.dsBm), "wrong size %u\n", ret );
DeleteObject( bitmap );
@ -139,7 +139,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
todo_wine ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
ret = GetObjectW( bitmap, sizeof(dib), &dib );
ok( ret == sizeof(dib), "wrong size %u\n", ret );
DeleteObject( brush );
@ -152,7 +152,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
todo_wine ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
"wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
DeleteObject( brush );
@ -165,8 +165,8 @@ static void test_pattern_brush(void)
ret = GetObjectW( brush, sizeof(br), &br );
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
todo_wine ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
todo_wine ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
"wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
mem = GlobalAlloc( GMEM_MOVEABLE, sizeof(buffer) );
@ -181,10 +181,10 @@ static void test_pattern_brush(void)
ret = GetObjectW( brush, sizeof(br), &br );
ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
todo_wine ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
ok( (HGLOBAL)br.lbHatch != mem, "wrong handle %p/%p\n", (HGLOBAL)br.lbHatch, mem );
bits = GlobalLock( mem );
todo_wine ok( (HGLOBAL)br.lbHatch == bits || broken(!br.lbHatch), /* nt4 */
ok( (HGLOBAL)br.lbHatch == bits || broken(!br.lbHatch), /* nt4 */
"wrong handle %p/%p\n", (HGLOBAL)br.lbHatch, bits );
ret = GlobalFlags( mem );
ok( ret == 2, "wrong flags %x\n", ret );