Commit b47debdd authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Return the original brush data in GetObject.

parent a16dbbe3
...@@ -161,7 +161,6 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush ) ...@@ -161,7 +161,6 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
case BS_PATTERN: case BS_PATTERN:
ptr->bitmap = BITMAP_CopyBitmap( (HBITMAP)ptr->logbrush.lbHatch ); ptr->bitmap = BITMAP_CopyBitmap( (HBITMAP)ptr->logbrush.lbHatch );
if (!ptr->bitmap) goto error; if (!ptr->bitmap) goto error;
ptr->logbrush.lbHatch = (ULONG_PTR)ptr->bitmap;
ptr->logbrush.lbColor = 0; ptr->logbrush.lbColor = 0;
break; break;
...@@ -176,7 +175,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush ) ...@@ -176,7 +175,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
if (!ptr->info) goto error; if (!ptr->info) goto error;
ptr->bits.ptr = (char *)ptr->info + bitmap_info_size( ptr->info, ptr->usage ); ptr->bits.ptr = (char *)ptr->info + bitmap_info_size( ptr->info, ptr->usage );
ptr->logbrush.lbStyle = BS_DIBPATTERN; ptr->logbrush.lbStyle = BS_DIBPATTERN;
ptr->logbrush.lbHatch = (ULONG_PTR)ptr->info; ptr->logbrush.lbColor = 0;
break; break;
case BS_DIBPATTERN8X8: case BS_DIBPATTERN8X8:
...@@ -446,7 +445,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc ) ...@@ -446,7 +445,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if(pattern_dev == dc->dibdrv) if(pattern_dev == dc->dibdrv)
pattern_dev = GET_NEXT_PHYSDEV( physdev, pSelectBrush ); pattern_dev = GET_NEXT_PHYSDEV( physdev, pSelectBrush );
BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, pattern_dev ); BITMAP_SetOwnerDC( bitmap, pattern_dev );
} }
info = brush->info; info = brush->info;
......
...@@ -100,7 +100,7 @@ static void test_pattern_brush(void) ...@@ -100,7 +100,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle ); ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor ); 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 ); DeleteObject( brush );
br.lbStyle = BS_PATTERN8X8; br.lbStyle = BS_PATTERN8X8;
...@@ -113,7 +113,7 @@ static void test_pattern_brush(void) ...@@ -113,7 +113,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle ); ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor ); 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 ); ret = GetObjectW( bitmap, sizeof(dib), &dib );
ok( ret == sizeof(dib.dsBm), "wrong size %u\n", ret ); ok( ret == sizeof(dib.dsBm), "wrong size %u\n", ret );
DeleteObject( bitmap ); DeleteObject( bitmap );
...@@ -139,7 +139,7 @@ static void test_pattern_brush(void) ...@@ -139,7 +139,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle ); ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor ); 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 ); ret = GetObjectW( bitmap, sizeof(dib), &dib );
ok( ret == sizeof(dib), "wrong size %u\n", ret ); ok( ret == sizeof(dib), "wrong size %u\n", ret );
DeleteObject( brush ); DeleteObject( brush );
...@@ -152,7 +152,7 @@ static void test_pattern_brush(void) ...@@ -152,7 +152,7 @@ static void test_pattern_brush(void)
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle ); ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
ok( br.lbColor == 0, "wrong color %u\n", br.lbColor ); 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 ); "wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
DeleteObject( brush ); DeleteObject( brush );
...@@ -165,8 +165,8 @@ static void test_pattern_brush(void) ...@@ -165,8 +165,8 @@ static void test_pattern_brush(void)
ret = GetObjectW( brush, sizeof(br), &br ); ret = GetObjectW( brush, sizeof(br), &br );
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle ); 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 );
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 ); "wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
mem = GlobalAlloc( GMEM_MOVEABLE, sizeof(buffer) ); mem = GlobalAlloc( GMEM_MOVEABLE, sizeof(buffer) );
...@@ -181,10 +181,10 @@ static void test_pattern_brush(void) ...@@ -181,10 +181,10 @@ static void test_pattern_brush(void)
ret = GetObjectW( brush, sizeof(br), &br ); ret = GetObjectW( brush, sizeof(br), &br );
ok( ret == sizeof(br), "wrong size %u\n", ret ); ok( ret == sizeof(br), "wrong size %u\n", ret );
ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle ); 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 ); ok( (HGLOBAL)br.lbHatch != mem, "wrong handle %p/%p\n", (HGLOBAL)br.lbHatch, mem );
bits = GlobalLock( 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 ); "wrong handle %p/%p\n", (HGLOBAL)br.lbHatch, bits );
ret = GlobalFlags( mem ); ret = GlobalFlags( mem );
ok( ret == 2, "wrong flags %x\n", ret ); ok( ret == 2, "wrong flags %x\n", ret );
......
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