Author: jgardou
Date: Sat Apr 17 22:27:32 2010
New Revision: 46908

URL: http://svn.reactos.org/svn/reactos?rev=46908&view=rev
Log:
[WIN32K]
  - Now we welcome GreStretchBltMask into the fabulous world of 
GDIOBJ_LockMultipleObjects, DC_vPrepareDCsForBlit and DC_vFinishBlit
  - With the assorted MouseSafetyOnDraw{Start,End} removal

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c
    branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c?rev=46908&r1=46907&r2=46908&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c 
[iso-8859-1] Sat Apr 17 22:27:32 2010
@@ -463,8 +463,6 @@
     /* No success yet */
     ret = FALSE;
     SURFACE_LockBitmapBits(psurfDest);
-    MouseSafetyOnDrawStart(psoDest, OutputRect.left, OutputRect.top,
-                           OutputRect.right, OutputRect.bottom);
 
     if (UsesSource)
     {
@@ -473,8 +471,6 @@
         {
             SURFACE_LockBitmapBits(psurfSource);
         }
-        MouseSafetyOnDrawStart(psoSource, InputRect.left, InputRect.top,
-                               InputRect.right, InputRect.bottom);
     }
 
     /* Prepare color adjustment */
@@ -516,13 +512,11 @@
 
     if (UsesSource)
     {
-        MouseSafetyOnDrawEnd(psoSource);
         if (psoSource != psoDest)
         {
             SURFACE_UnlockBitmapBits(psurfSource);
         }
     }
-    MouseSafetyOnDrawEnd(psoDest);
     SURFACE_UnlockBitmapBits(psurfDest);
 
     return ret;

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=46908&r1=46907&r2=46908&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 22:27:32 2010
@@ -708,6 +708,8 @@
     PDC DCDest;
     PDC DCSrc  = NULL;
     PDC DCMask = NULL;
+    HDC ahDC[3];
+    PGDIOBJ apObj[3];
     PDC_ATTR pdcattr;
     SURFACE *BitmapDest, *BitmapSrc = NULL;
     SURFACE *BitmapMask = NULL;
@@ -726,45 +728,55 @@
         return FALSE;
     }
 
-    DCDest = DC_LockDc(hDCDest);
+    DPRINT("Locking DCs\n");
+    ahDC[0] = hDCDest;
+    ahDC[1] = hDCSrc ;
+    ahDC[2] = hDCMask ;
+    GDIOBJ_LockMultipleObjs(3, ahDC, apObj);
+    DCDest = apObj[0];
+    DCSrc = apObj[1];
+    DCMask = apObj[2];
+
     if (NULL == DCDest)
     {
-        DPRINT1("Invalid destination dc handle (0x%08x) passed to 
NtGdiStretchBlt\n", hDCDest);
-        SetLastWin32Error(ERROR_INVALID_HANDLE);
+        if(DCSrc) GDIOBJ_UnlockObjByPtr(&DCSrc->BaseObject);
+        if(DCMask) GDIOBJ_UnlockObjByPtr(&DCMask->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);
+        if(DCMask) GDIOBJ_UnlockObjByPtr(&DCMask->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);
-                DPRINT1("Invalid source dc handle (0x%08x) passed to 
NtGdiStretchBlt\n", hDCSrc);
-                SetLastWin32Error(ERROR_INVALID_HANDLE);
-                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);
+            if(DCMask) GDIOBJ_UnlockObjByPtr(&DCMask->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);
+            if(DCMask) GDIOBJ_UnlockObjByPtr(&DCMask->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;
@@ -801,6 +813,9 @@
     BrushOrigin.x = 0;
     BrushOrigin.y = 0;
 
+    /* Only prepare Source and Dest, hdcMask represents a DIB */
+    DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
+
     /* Determine surfaces to be used in the bitblt */
     BitmapDest = DCDest->dclevel.pSurface;
     if (BitmapDest == NULL)
@@ -821,28 +836,25 @@
     BrushOrigin.y += DCDest->ptlDCOrig.y;
 
     /* Make mask surface for source surface */
-    if (BitmapSrc && hDCMask)
-    {
-        DCMask = DC_LockDc(hDCMask);
-        if (DCMask)
+    if (BitmapSrc && DCMask)
+    {
+        BitmapMask = DCMask->dclevel.pSurface;
+        if (BitmapMask &&
+            (BitmapMask->SurfObj.sizlBitmap.cx < WidthSrc ||
+             BitmapMask->SurfObj.sizlBitmap.cy < HeightSrc))
         {
-            BitmapMask = DCMask->dclevel.pSurface;
-            if (BitmapMask &&
-                (BitmapMask->SurfObj.sizlBitmap.cx < WidthSrc ||
-                 BitmapMask->SurfObj.sizlBitmap.cy < HeightSrc))
-            {
-                DPRINT1("%dx%d mask is smaller than %dx%d bitmap\n",
-                        BitmapMask->SurfObj.sizlBitmap.cx, 
BitmapMask->SurfObj.sizlBitmap.cy,
-                        WidthSrc, HeightSrc);
-                goto failed;
-            }
-            /* Create mask offset point */
-            MaskPoint.x = XOriginMask;
-            MaskPoint.y = YOriginMask;
-            IntLPtoDP(DCMask, &MaskPoint, 1);
-            MaskPoint.x += DCMask->ptlDCOrig.x;
-            MaskPoint.y += DCMask->ptlDCOrig.x;
+            DPRINT1("%dx%d mask is smaller than %dx%d bitmap\n",
+                    BitmapMask->SurfObj.sizlBitmap.cx, 
BitmapMask->SurfObj.sizlBitmap.cy,
+                    WidthSrc, HeightSrc);
+            EXLATEOBJ_vCleanup(&exlo);
+            goto failed;
         }
+        /* Create mask offset point */
+        MaskPoint.x = XOriginMask;
+        MaskPoint.y = YOriginMask;
+        IntLPtoDP(DCMask, &MaskPoint, 1);
+        MaskPoint.x += DCMask->ptlDCOrig.x;
+        MaskPoint.y += DCMask->ptlDCOrig.x;
     }
 
     /* Perform the bitblt operation */
@@ -857,13 +869,14 @@
                               &DCDest->eboFill.BrushObject,
                               &BrushOrigin,
                               ROP3_TO_ROP4(ROP));
+    if (UsesSource)
+    {
+        EXLATEOBJ_vCleanup(&exlo);
+    }
 
 failed:
+    DC_vFinishBlit(DCDest, DCSrc);
     if (UsesSource)
-    {
-        EXLATEOBJ_vCleanup(&exlo);
-    }
-    if (UsesSource && hDCSrc != hDCDest)
     {
         DC_UnlockDc(DCSrc);
     }


Reply via email to