- Cleanup UnrealizeObject and set dvNumAxes in CreateFontIndirect.
authorJames Tabor <james.tabor@reactos.org>
Mon, 3 Nov 2008 08:39:08 +0000 (08:39 +0000)
committerJames Tabor <james.tabor@reactos.org>
Mon, 3 Nov 2008 08:39:08 +0000 (08:39 +0000)
svn path=/trunk/; revision=37163

reactos/dll/win32/gdi32/misc/stubs.c
reactos/dll/win32/gdi32/objects/font.c
reactos/subsystems/win32/win32k/objects/color.c

index fd2ec1f..25c7b90 100644 (file)
@@ -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);
index 42dc263..aa1bf78 100644 (file)
@@ -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);
index 6800479..7ab65c5 100644 (file)
@@ -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;
 }