Author: jgardou
Date: Sat Apr 17 17:24:10 2010
New Revision: 46906

URL: http://svn.reactos.org/svn/reactos?rev=46906&view=rev
Log:
[WIN32K]
  - For now, limit DC_UnlockDc to a simple GDIOBJ_LockObj
  - More GDIOBJ_LockMultipleObj, DC_vPrepareDCsForBlit and DC_vFinishBlit fun

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
    branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
    branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] 
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] 
Sat Apr 17 17:24:10 2010
@@ -592,11 +592,7 @@
             {
                 SURFACE_LockBitmapBits(psurfSrc);
             }
-            MouseSafetyOnDrawStart(psoSrc, rclSrc.left, rclSrc.top,
-                                   rclSrc.right, rclSrc.bottom);
-        }
-        MouseSafetyOnDrawStart(psoTrg, rclClipped.left, rclClipped.top,
-                               rclClipped.right, rclClipped.bottom);
+        }
     }
 
     /* Is the target surface device managed? */
@@ -638,16 +634,13 @@
 
     if (bRemoveMouse)
     {
-        MouseSafetyOnDrawEnd(psoTrg);
         if (psoSrc)
         {
-            MouseSafetyOnDrawEnd(psoSrc);
             if (psoSrc != psoTrg)
             {
                 SURFACE_UnlockBitmapBits(psurfSrc);
             }
         }
-
         SURFACE_UnlockBitmapBits(psurfTrg);
     }
 

Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h [iso-8859-1] 
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/dc.h [iso-8859-1] 
Sat Apr 17 17:24:10 2010
@@ -152,12 +152,12 @@
 
 /* Internal functions 
*********************************************************/
 
-#if 0
+#if 1
 #define  DC_LockDc(hDC)  \
   ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
 #define  DC_UnlockDc(pDC)  \
   GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
-#endif
+#else
 
 VOID NTAPI EngAcquireSemaphoreShared(IN HSEMAPHORE hsem);
 
@@ -196,6 +196,7 @@
 
     GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
 }
+#endif
 
 
 extern PDC defaultDCstate;

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c 
[iso-8859-1] Sat Apr 17 17:24:10 2010
@@ -171,52 +171,60 @@
 {
     PDC DCDest;
     PDC DCSrc = NULL;
+    HDC ahDC[2];
+    PGDIOBJ apObj[2];
     PDC_ATTR pdcattr = NULL;
     SURFACE *BitmapDest, *BitmapSrc = NULL;
-    RECTL DestRect;
+    RECTL DestRect, SourceRect;
     POINTL SourcePoint;
     BOOL Status = FALSE;
     EXLATEOBJ exlo;
     XLATEOBJ *XlateObj = NULL;
     BOOL UsesSource = ROP3_USES_SOURCE(ROP);
 
-    DCDest = DC_LockDc(hDCDest);
+    DPRINT("Locking DCs\n");
+    ahDC[0] = hDCDest;
+    ahDC[1] = hDCSrc ;
+    GDIOBJ_LockMultipleObjs(2, ahDC, apObj);
+    DCDest = apObj[0];
+    DCSrc = apObj[1];
+
     if (NULL == DCDest)
     {
+        if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
         DPRINT("Invalid destination dc handle (0x%08x) passed to 
NtGdiBitBlt\n", hDCDest);
         return FALSE;
     }
 
     if (DCDest->dctype == DC_TYPE_INFO)
     {
-        DC_UnlockDc(DCDest);
+        if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
+        GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
         /* Yes, Windows really returns TRUE in this case */
         return TRUE;
     }
 
     if (UsesSource)
     {
-        if (hDCSrc != hDCDest)
+        if (NULL == DCSrc)
         {
-            DCSrc = DC_LockDc(hDCSrc);
-            if (NULL == DCSrc)
-            {
-                DC_UnlockDc(DCDest);
-                DPRINT("Invalid source dc handle (0x%08x) passed to 
NtGdiBitBlt\n", hDCSrc);
-                return FALSE;
-            }
-            if (DCSrc->dctype == DC_TYPE_INFO)
-            {
-                DC_UnlockDc(DCSrc);
-                DC_UnlockDc(DCDest);
-                /* Yes, Windows really returns TRUE in this case */
-                return TRUE;
-            }
+            GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
+            DPRINT("Invalid source dc handle (0x%08x) passed to 
NtGdiBitBlt\n", hDCSrc);
+            return FALSE;
         }
-        else
+        if (DCSrc->dctype == DC_TYPE_INFO)
         {
-            DCSrc = DCDest;
+            GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
+            GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
+            /* Yes, Windows really returns TRUE in this case */
+            return TRUE;
         }
+    }
+    else if(DCSrc)
+    {
+        DPRINT1("Getting a valid Source handle without using source!!!");
+        GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
+        DCSrc = NULL ;
     }
 
     pdcattr = DCDest->pdcattr;
@@ -244,7 +252,15 @@
 
         SourcePoint.x += DCSrc->ptlDCOrig.x;
         SourcePoint.y += DCSrc->ptlDCOrig.y;
-    }
+        /* Calculate Source Rect */
+        SourceRect.left = SourcePoint.x;
+        SourceRect.top = SourcePoint.y;
+        SourceRect.right = SourcePoint.x + DestRect.right - DestRect.left;
+        SourceRect.bottom = SourcePoint.y + DestRect.bottom - DestRect.top ;
+    }
+
+    /* Prepare blit */
+    DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
 
     /* Determine surfaces to be used in the bitblt */
     BitmapDest = DCDest->dclevel.pSurface;
@@ -280,14 +296,15 @@
                           &DCDest->dclevel.pbrFill->ptOrigin,
                           ROP3_TO_ROP4(ROP));
 
-cleanup:
     if (UsesSource)
         EXLATEOBJ_vCleanup(&exlo);
-    if (UsesSource && hDCSrc != hDCDest)
-    {
-        DC_UnlockDc(DCSrc);
-    }
-    DC_UnlockDc(DCDest);
+cleanup:
+    DC_vFinishBlit(DCDest, DCSrc);
+    if (UsesSource)
+    {
+        GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
+    }
+    GDIOBJ_UnlockObjByPtr(&DCDest->BaseObject);
 
     return Status;
 }
@@ -958,6 +975,8 @@
 
     EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
 
+    DC_vPrepareDCsForBlit(pdc, DestRect, NULL, DestRect);
+
     ret = IntEngBitBlt(
         &psurf->SurfObj,
         NULL,
@@ -972,6 +991,8 @@
         ROP3_TO_ROP4(dwRop));
 
     EBRUSHOBJ_vCleanup(&eboFill);
+
+    DC_vFinishBlit(pdc, NULL);
 
     return ret;
 }

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c?rev=46906&r1=46905&r2=46906&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c 
[iso-8859-1] Sat Apr 17 17:24:10 2010
@@ -115,11 +115,13 @@
     DCTYPE dctype,
     PPDEVOBJ ppdev)
 {
+#if 0
     if (dctype == DCTYPE_DIRECT)
     {
         /* Lock ppdev */
         EngAcquireSemaphoreShared(ppdev->hsemDevLock);
     }
+#endif
 
     /* Setup some basic fields */
     pdc->dctype = dctype;


Reply via email to