[ros-diffs] [tkreuzer] 56427: [WIN32K] Pass EBRUSHOBJ to IntPatBlt instead of the BRUSH. This way we can use the DC's eboFill, instead of initializing a new EBRUSHOBJ.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Apr 26 09:30:16 UTC 2012


Author: tkreuzer
Date: Thu Apr 26 09:30:15 2012
New Revision: 56427

URL: http://svn.reactos.org/svn/reactos?rev=56427&view=rev
Log:
[WIN32K]
Pass EBRUSHOBJ to IntPatBlt instead of the BRUSH. This way we can use the DC's eboFill, instead of initializing a new EBRUSHOBJ.

Modified:
    trunk/reactos/win32ss/gdi/ntgdi/bitblt.c

Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?rev=56427&r1=56426&r2=56427&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Thu Apr 26 09:30:15 2012
@@ -733,15 +733,15 @@
     INT Width,
     INT Height,
     DWORD dwRop,
-    PBRUSH pbrush)
+    PEBRUSHOBJ pebo)
 {
     RECTL DestRect;
     SURFACE *psurf;
-    EBRUSHOBJ eboFill ;
     POINTL BrushOrigin;
     BOOL ret;
-
-    ASSERT(pbrush);
+    PBRUSH pbrush = pebo->pbrush;
+
+    ASSERT(pebo);
 
     FIXUP_ROP(dwRop);
 
@@ -790,11 +790,6 @@
 
     psurf = pdc->dclevel.pSurface;
 
-    if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
-        DC_vUpdateFillBrush(pdc);
-
-    EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
-
     ret = IntEngBitBlt(
         &psurf->SurfObj,
         NULL,
@@ -804,13 +799,11 @@
         &DestRect,
         NULL,
         NULL,
-        &eboFill.BrushObject,
+        &pebo->BrushObject,
         &BrushOrigin,
         ROP_TO_ROP4(dwRop));
 
     DC_vFinishBlit(pdc, NULL);
-
-    EBRUSHOBJ_vCleanup(&eboFill);
 
     return ret;
 }
@@ -826,6 +819,7 @@
     INT i;
     PBRUSH pbrush;
     PDC pdc;
+    EBRUSHOBJ eboFill;
 
     pdc = DC_LockDc(hDC);
     if (!pdc)
@@ -844,8 +838,13 @@
     for (i = 0; i < cRects; i++)
     {
         pbrush = BRUSH_ShareLockBrush(pRects->hBrush);
-        if(pbrush != NULL)
-        {
+
+        /* Check if we could lock the brush */
+        if (pbrush != NULL)
+        {
+            /* Initialize a brush object */
+            EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
+
             IntPatBlt(
                 pdc,
                 pRects->r.left,
@@ -853,7 +852,10 @@
                 pRects->r.right,
                 pRects->r.bottom,
                 dwRop,
-                pbrush);
+                &eboFill);
+
+            /* Cleanup the brush object and unlock the brush */
+            EBRUSHOBJ_vCleanup(&eboFill);
             BRUSH_ShareUnlockBrush(pbrush);
         }
         pRects++;
@@ -873,7 +875,6 @@
     INT Height,
     DWORD ROP)
 {
-    PBRUSH pbrush;
     DC *dc;
     PDC_ATTR pdcattr;
     BOOL ret;
@@ -884,8 +885,6 @@
         /* In this case we call on GdiMaskBlt */
         return NtGdiMaskBlt(hDC, XLeft, YLeft, Width, Height, 0,0,0,0,0,0,ROP,0);
     }
-
-if ((XLeft == 0) && (YLeft == 0) && (Width == 592) && (Height == 362)) __debugbreak();
 
     dc = DC_LockDc(hDC);
     if (dc == NULL)
@@ -906,17 +905,8 @@
     if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
         DC_vUpdateFillBrush(dc);
 
-    pbrush = BRUSH_ShareLockBrush(pdcattr->hbrush);
-    if (pbrush == NULL)
-    {
-        EngSetLastError(ERROR_INVALID_HANDLE);
-        DC_UnlockDc(dc);
-        return FALSE;
-    }
-
-    ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, pbrush);
-
-    BRUSH_ShareUnlockBrush(pbrush);
+    ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, &dc->eboFill);
+
     DC_UnlockDc(dc);
 
     return ret;




More information about the Ros-diffs mailing list