From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/gdi32/gdiobj.c | 77 -------------------------------------------- dlls/gdi32/objects.c | 73 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 77 deletions(-)
diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 67550d7f724..2937cdcf48f 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1085,83 +1085,6 @@ BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj ) }
-/* Solid colors to enumerate */ -static const COLORREF solid_colors[] = -{ RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff), -RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00), -RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00), -RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff), -RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00), -RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80), -RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80), -RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0) -}; - - -/*********************************************************************** - * EnumObjects (GDI32.@) - */ -INT WINAPI EnumObjects( HDC hdc, INT nObjType, - GOBJENUMPROC lpEnumFunc, LPARAM lParam ) -{ - UINT i; - INT retval = 0; - LOGPEN pen; - LOGBRUSH brush; - - TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam ); - switch(nObjType) - { - case OBJ_PEN: - /* Enumerate solid pens */ - for (i = 0; i < ARRAY_SIZE( solid_colors ); i++) - { - pen.lopnStyle = PS_SOLID; - pen.lopnWidth.x = 1; - pen.lopnWidth.y = 0; - pen.lopnColor = solid_colors[i]; - retval = lpEnumFunc( &pen, lParam ); - TRACE("solid pen %08x, ret=%d\n", - solid_colors[i], retval); - if (!retval) break; - } - break; - - case OBJ_BRUSH: - /* Enumerate solid brushes */ - for (i = 0; i < ARRAY_SIZE( solid_colors ); i++) - { - brush.lbStyle = BS_SOLID; - brush.lbColor = solid_colors[i]; - brush.lbHatch = 0; - retval = lpEnumFunc( &brush, lParam ); - TRACE("solid brush %08x, ret=%d\n", - solid_colors[i], retval); - if (!retval) break; - } - - /* Now enumerate hatched brushes */ - if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) - { - brush.lbStyle = BS_HATCHED; - brush.lbColor = RGB(0,0,0); - brush.lbHatch = i; - retval = lpEnumFunc( &brush, lParam ); - TRACE("hatched brush %d, ret=%d\n", - i, retval); - if (!retval) break; - } - break; - - default: - /* FIXME: implement Win32 types */ - WARN("(%d): Invalid type\n", nObjType ); - break; - } - return retval; -} - - /*********************************************************************** * NtGdiFlush (win32u.@) */ diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 830d187c9a2..bdd4a03fe34 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -821,3 +821,76 @@ DWORD WINAPI GdiSetBatchLimit( DWORD limit ) { return 1; /* FIXME */ } + +/* Solid colors to enumerate */ +static const COLORREF solid_colors[] = +{ + RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff), + RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00), + RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00), + RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff), + RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00), + RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80), + RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80), + RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0) +}; + +/*********************************************************************** + * EnumObjects (GDI32.@) + */ +INT WINAPI EnumObjects( HDC hdc, INT type, GOBJENUMPROC enum_func, LPARAM param ) +{ + UINT i; + INT retval = 0; + LOGPEN pen; + LOGBRUSH brush; + + TRACE( "%p %d %p %08lx\n", hdc, type, enum_func, param ); + + switch(type) + { + case OBJ_PEN: + /* Enumerate solid pens */ + for (i = 0; i < ARRAY_SIZE(solid_colors); i++) + { + pen.lopnStyle = PS_SOLID; + pen.lopnWidth.x = 1; + pen.lopnWidth.y = 0; + pen.lopnColor = solid_colors[i]; + retval = enum_func( &pen, param ); + TRACE( "solid pen %08x, ret=%d\n", solid_colors[i], retval ); + if (!retval) break; + } + break; + + case OBJ_BRUSH: + /* Enumerate solid brushes */ + for (i = 0; i < ARRAY_SIZE(solid_colors); i++) + { + brush.lbStyle = BS_SOLID; + brush.lbColor = solid_colors[i]; + brush.lbHatch = 0; + retval = enum_func( &brush, param ); + TRACE( "solid brush %08x, ret=%d\n", solid_colors[i], retval ); + if (!retval) break; + } + + /* Now enumerate hatched brushes */ + for (i = HS_HORIZONTAL; retval && i <= HS_DIAGCROSS; i++) + { + brush.lbStyle = BS_HATCHED; + brush.lbColor = RGB(0,0,0); + brush.lbHatch = i; + retval = enum_func( &brush, param ); + TRACE( "hatched brush %d, ret=%d\n", i, retval ); + } + break; + + default: + /* FIXME: implement Win32 types */ + WARN( "(%d): Invalid type\n", type ); + break; + } + + return retval; +}