[CMAKE]
[reactos.git] / subsystems / win32 / win32k / objects / path.c
index 8a9010c..82ccf43 100644 (file)
@@ -33,7 +33,8 @@
  */
 
 #include <win32k.h>
-#include "math.h"
+#define _USE_MATH_DEFINES
+#include <math.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -69,8 +70,7 @@ PATH_Delete(HPATH hPath)
   pPath = PATH_LockPath( hPath );
   if (!pPath) return FALSE;
   PATH_DestroyGdiPath( pPath );
-  PATH_UnlockPath( pPath );
-  PATH_FreeExtPathByHandle(hPath);
+  GDIOBJ_vDeleteObject(&pPath->BaseObject);
   return TRUE;
 }
 
@@ -1526,7 +1526,7 @@ PATH_WidenPath(DC *dc)
 
     PATH_FlattenPath(pPath);
 
-    size = IntGdiGetObject( pdcattr->hpen, 0, NULL);
+    size = GreGetObject( pdcattr->hpen, 0, NULL);
     if (!size)
     {
         PATH_UnlockPath( pPath );
@@ -1535,9 +1535,9 @@ PATH_WidenPath(DC *dc)
     }
 
     elp = ExAllocatePoolWithTag(PagedPool, size, TAG_PATH);
-    (VOID) IntGdiGetObject( pdcattr->hpen, size, elp);
+    GreGetObject(pdcattr->hpen, size, elp);
 
-    obj_type = GDIOBJ_GetObjectType(pdcattr->hpen);
+    obj_type = GDI_HANDLE_GET_TYPE(pdcattr->hpen);
     if(obj_type == GDI_OBJECT_TYPE_PEN)
     {
         penStyle = ((LOGPEN*)elp)->lopnStyle;
@@ -1857,13 +1857,14 @@ PATH_WidenPath(DC *dc)
         PATH_DestroyGdiPath(pDownPath);
         ExFreePoolWithTag(pDownPath, TAG_PATH);
     }
-    ExFreePoolWithTag(pStrokes, TAG_PATH);
+    if (pStrokes) ExFreePoolWithTag(pStrokes, TAG_PATH);
 
     pNewPath->state = PATH_Closed;
     if (!(ret = PATH_AssignGdiPath(pPath, pNewPath)))
         DPRINT1("Assign path failed\n");
     PATH_DestroyGdiPath(pNewPath);
     ExFreePoolWithTag(pNewPath, TAG_PATH);
+    PATH_UnlockPath(pPath);
     return ret;
 }
 
@@ -2040,6 +2041,7 @@ PATH_ExtTextOut(PDC dc, INT x, INT y, UINT flags, const RECTL *lprc,
     if ( !TextObj ) return FALSE;
 
     FontGetObject( TextObj, sizeof(lf), &lf);
+    TEXTOBJ_UnlockText(TextObj);
 
     if (lf.lfEscapement != 0)
     {
@@ -2118,6 +2120,7 @@ NtGdiAbortPath(HDC  hDC)
   }
 
   pPath = PATH_LockPath(dc->dclevel.hPath);
+  if (!pPath)
   {
       DC_UnlockDc(dc);
       return FALSE;
@@ -2126,6 +2129,8 @@ NtGdiAbortPath(HDC  hDC)
   PATH_EmptyPath(pPath);
 
   PATH_UnlockPath(pPath);
+  dc->dclevel.flPath &= ~DCPATH_ACTIVE;
+
   DC_UnlockDc ( dc );
   return TRUE;
 }
@@ -2153,7 +2158,7 @@ NtGdiBeginPath( HDC  hDC )
 
   if ( dc->dclevel.hPath )
   {
-     DPRINT1("BeginPath 1 0x%x\n", dc->dclevel.hPath);
+     DPRINT("BeginPath 1 0x%x\n", dc->dclevel.hPath);
      if ( !(dc->dclevel.flPath & DCPATH_SAVE) )
      {  // Remove previous handle.
         if (!PATH_Delete(dc->dclevel.hPath))
@@ -2178,9 +2183,9 @@ NtGdiBeginPath( HDC  hDC )
 
   dc->dclevel.hPath = pPath->BaseObject.hHmgr;
 
-  DPRINT1("BeginPath 2 h 0x%x p 0x%x\n", dc->dclevel.hPath, pPath);
+  DPRINT("BeginPath 2 h 0x%x p 0x%x\n", dc->dclevel.hPath, pPath);
   // Path handles are shared. Also due to recursion with in the same thread.
-  GDIOBJ_UnlockObjByPtr((POBJ)pPath);       // Unlock
+  GDIOBJ_vUnlockObject((POBJ)pPath);       // Unlock
   pPath = PATH_LockPath(dc->dclevel.hPath); // Share Lock.
 
   /* Make sure that path is empty */
@@ -2264,7 +2269,7 @@ NtGdiEndPath(HDC  hDC)
   /* Set flag to indicate that path is finished */
   else
   {
-     DPRINT1("EndPath 0x%x\n", dc->dclevel.hPath);
+     DPRINT("EndPath 0x%x\n", dc->dclevel.hPath);
      pPath->state = PATH_Closed;
      dc->dclevel.flPath &= ~DCPATH_ACTIVE;
   }
@@ -2280,13 +2285,15 @@ NtGdiFillPath(HDC  hDC)
   BOOL ret = FALSE;
   PPATH pPath;
   PDC_ATTR pdcattr;
-  PDC dc = DC_LockDc ( hDC );
+  PDC dc;
 
-  if ( !dc )
+  dc = DC_LockDc(hDC);
+  if (!dc)
   {
      EngSetLastError(ERROR_INVALID_PARAMETER);
      return FALSE;
   }
+
   pPath = PATH_LockPath( dc->dclevel.hPath );
   if (!pPath)
   {