[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Sat, 17 Apr 2010 20:51:42 +0000 (20:51 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Sat, 17 Apr 2010 20:51:42 +0000 (20:51 +0000)
  - apply policy into DC_vPrepareDCsForBlit as in GDIOBJ_LockMultipleObjects before Physicus sees this :-D
  - GDIOBJ_LockObj : return NULL when handle is NULL : more speed, less debug output

svn path=/branches/reactos-yarotows/; revision=46909

subsystems/win32/win32k/objects/dclife.c
subsystems/win32/win32k/objects/gdiobj.c

index 5b8636f..56fb2fa 100644 (file)
@@ -463,15 +463,50 @@ DC_vPrepareDCsForBlit(PDC pdc1,
                       PDC pdc2,
                       RECT rc2)
 {
-    if(pdc1->dctype == DCTYPE_DIRECT)
+    PDC pdcFirst, pdcSecond;
+    PRECT prcFirst, prcSecond;
+    /* Lock them in good order */
+    if(pdc2)
     {
-        EngAcquireSemaphore(pdc1->ppdev->hsemDevLock);
-        MouseSafetyOnDrawStart(&pdc1->dclevel.pSurface->SurfObj, rc1.left, rc1.top, rc1.right, rc1.bottom) ;
+        if((ULONG_PTR)pdc1->BaseObject.hHmgr >= (ULONG_PTR)pdc2->BaseObject.hHmgr)
+        {
+            pdcFirst = pdc1;
+            prcFirst = &rc1;
+            pdcSecond = pdc2;
+            prcSecond = &rc2;
+        }
+        else
+        {
+            pdcFirst = pdc2;
+            prcFirst = &rc2;
+            pdcSecond = pdc1;
+            prcSecond = &rc1;
+        }
     }
-    if(pdc2 && pdc2->dctype == DCTYPE_DIRECT)
+    else
+    {
+        pdcFirst = pdc1 ;
+        prcFirst = &rc1;
+        pdcSecond = NULL ;
+    }
+
+    if(pdcFirst && pdcFirst->dctype == DCTYPE_DIRECT)
+    {
+        EngAcquireSemaphore(pdcFirst->ppdev->hsemDevLock);
+        MouseSafetyOnDrawStart(&pdcFirst->dclevel.pSurface->SurfObj,
+                                    prcFirst->left,
+                                    prcFirst->top,
+                                    prcFirst->right,
+                                    prcFirst->bottom) ;
+    }
+    if(pdcSecond && pdcSecond->dctype == DCTYPE_DIRECT)
     {
-        EngAcquireSemaphore(pdc2->ppdev->hsemDevLock);
-        MouseSafetyOnDrawStart(&pdc2->dclevel.pSurface->SurfObj, rc2.left, rc2.top, rc2.right, rc2.bottom) ;
+        EngAcquireSemaphore(pdcSecond->ppdev->hsemDevLock);
+        MouseSafetyOnDrawStart(&pdcSecond->dclevel.pSurface->SurfObj,
+                                    prcSecond->left,
+                                    prcSecond->top,
+                                    prcSecond->right,
+                                    prcSecond->bottom) ;
     }
 }
 
index 66d0505..c74ccb4 100644 (file)
@@ -952,6 +952,10 @@ GDIOBJ_LockObj(HGDIOBJ hObj, DWORD ExpectedType)
     POBJ Object = NULL;
     ULONG HandleType, HandleUpper;
 
+    /* Check for dummy call */
+    if(hObj == NULL)
+        return NULL ;
+
     GDIDBG_INITLOOPTRACE();
 
     HandleIndex = GDI_HANDLE_GET_INDEX(hObj);
@@ -959,7 +963,7 @@ GDIOBJ_LockObj(HGDIOBJ hObj, DWORD ExpectedType)
     HandleUpper = GDI_HANDLE_GET_UPPER(hObj);
 
     /* Check that the handle index is valid. */
-    if (HandleIndex >= GDI_HANDLE_COUNT)
+    if (HandleIndex >= GDI_HANDLE_COUNT )
         return NULL;
 
     Entry = &GdiHandleTable->Entries[HandleIndex];