From 3e91f163626f319f39986882e8b6cdb7a1fb5238 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 3 Nov 2008 08:39:08 +0000 Subject: [PATCH] - Cleanup UnrealizeObject and set dvNumAxes in CreateFontIndirect. svn path=/trunk/; revision=37163 --- reactos/dll/win32/gdi32/misc/stubs.c | 12 ++++ reactos/dll/win32/gdi32/objects/font.c | 2 + .../subsystems/win32/win32k/objects/color.c | 55 +++++-------------- 3 files changed, 29 insertions(+), 40 deletions(-) diff --git a/reactos/dll/win32/gdi32/misc/stubs.c b/reactos/dll/win32/gdi32/misc/stubs.c index fd2ec1f177e..25c7b9072e3 100644 --- a/reactos/dll/win32/gdi32/misc/stubs.c +++ b/reactos/dll/win32/gdi32/misc/stubs.c @@ -546,7 +546,19 @@ STDCALL UnrealizeObject(HGDIOBJ hgdiobj) { BOOL retValue = TRUE; +/* + Win 2k Graphics API, Black Book. by coriolis.com + Page 62, Note that Steps 3, 5, and 6 are not required for Windows NT(tm) + and Windows 2000(tm). + Step 5. UnrealizeObject(hTrackBrush); + */ +/* + msdn.microsoft.com, + "Windows 2000/XP: If hgdiobj is a brush, UnrealizeObject does nothing, + and the function returns TRUE. Use SetBrushOrgEx to set the origin of + a brush." + */ if (GDI_HANDLE_GET_TYPE(hgdiobj) != GDI_OBJECT_TYPE_BRUSH) { retValue = NtGdiUnrealizeObject(hgdiobj); diff --git a/reactos/dll/win32/gdi32/objects/font.c b/reactos/dll/win32/gdi32/objects/font.c index 42dc263c21e..aa1bf782781 100644 --- a/reactos/dll/win32/gdi32/objects/font.c +++ b/reactos/dll/win32/gdi32/objects/font.c @@ -1355,6 +1355,8 @@ CreateFontIndirectW( RtlZeroMemory( &Logfont.elfEnumLogfontEx.elfScript, sizeof(Logfont.elfEnumLogfontEx.elfScript)); + Logfont.elfDesignVector.dvNumAxes = 0; // No more than MM_MAX_NUMAXES + RtlZeroMemory( &Logfont.elfDesignVector, sizeof(DESIGNVECTOR)); return CreateFontIndirectExW(&Logfont); diff --git a/reactos/subsystems/win32/win32k/objects/color.c b/reactos/subsystems/win32/win32k/objects/color.c index 680047985b2..7ab65c5844b 100644 --- a/reactos/subsystems/win32/win32k/objects/color.c +++ b/reactos/subsystems/win32/win32k/objects/color.c @@ -685,52 +685,27 @@ NtGdiSetSystemPaletteUse(HDC hDC, UINT Usage) return old; } -/* - Win 2k Graphics API, Black Book. by coriolis.com - Page 62, Note that Steps 3, 5, and 6 are not required for Windows NT(tm) - and Windows 2000(tm). - - Step 5. UnrealizeObject(hTrackBrush); - */ -BOOL STDCALL +BOOL +STDCALL NtGdiUnrealizeObject(HGDIOBJ hgdiobj) { - - POBJ pObject; - DWORD objectType; BOOL Ret = FALSE; + PPALGDI palGDI; - /* From Wine: UnrealizeObject does not SetLastError() on a null object */ - if(!hgdiobj) - return Ret; - - pObject = GDIOBJ_LockObj(hgdiobj, GDI_OBJECT_TYPE_DONTCARE); - if (pObject == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); + if ( !hgdiobj || + ((UINT)hgdiobj & GDI_HANDLE_STOCK_MASK) || + !GDI_HANDLE_IS_TYPE(hgdiobj, GDI_OBJECT_TYPE_PALETTE) ) return Ret; - } - objectType = GDIOBJ_GetObjectType(hgdiobj); - switch(objectType) - { -/* - msdn.microsoft.com, - "Windows 2000/XP: If hgdiobj is a brush, UnrealizeObject does nothing, - and the function returns TRUE. Use SetBrushOrgEx to set the origin of - a brush." - */ - case GDI_OBJECT_TYPE_BRUSH: - { - DPRINT("GDI_OBJECT_TYPE_BRUSH\n"); - Ret = TRUE; - break; - } - default: - DPRINT1("Magic 0x%08x not implemented\n", objectType); - break; - } - GDIOBJ_UnlockObjByPtr(pObject); + palGDI = PALETTE_LockPalette(hgdiobj); + if (!palGDI) return FALSE; + + // FIXME!! + // Need to do something!!! + // Zero out Current and Old Translated pointers? + // + Ret = TRUE; + PALETTE_UnlockPalette(palGDI); return Ret; }