[WIN32K]
[reactos.git] / subsystems / win32 / win32k / objects / bitblt.c
index 22de7a5..f2bb3b2 100644 (file)
@@ -229,9 +229,6 @@ NtGdiBitBlt(
 
     pdcattr = DCDest->pdcattr;
 
-    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
-        DC_vUpdateFillBrush(DCDest);
-
     DestRect.left   = XDest;
     DestRect.top    = YDest;
     DestRect.right  = XDest+Width;
@@ -262,6 +259,9 @@ NtGdiBitBlt(
     /* Prepare blit */
     DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
 
+    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(DCDest);
+
     /* Determine surfaces to be used in the bitblt */
     BitmapDest = DCDest->dclevel.pSurface;
     if (!BitmapDest)
@@ -781,9 +781,6 @@ GreStretchBltMask(
 
     pdcattr = DCDest->pdcattr;
 
-    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
-        DC_vUpdateFillBrush(DCDest);
-
     DestRect.left   = XOriginDest;
     DestRect.top    = YOriginDest;
     DestRect.right  = XOriginDest+WidthDest;
@@ -816,6 +813,9 @@ GreStretchBltMask(
     /* Only prepare Source and Dest, hdcMask represents a DIB */
     DC_vPrepareDCsForBlit(DCDest, DestRect, DCSrc, SourceRect);
 
+    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(DCDest);
+
     /* Determine surfaces to be used in the bitblt */
     BitmapDest = DCDest->dclevel.pSurface;
     if (BitmapDest == NULL)
@@ -936,19 +936,11 @@ IntPatBlt(
 {
     RECTL DestRect;
     SURFACE *psurf;
-    EBRUSHOBJ eboFill;
     POINTL BrushOrigin;
     BOOL ret;
 
     ASSERT(pbrush);
 
-    psurf = pdc->dclevel.pSurface;
-    if (psurf == NULL)
-    {
-        SetLastWin32Error(ERROR_INVALID_HANDLE);
-        return FALSE;
-    }
-
     if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
     {
         return TRUE;
@@ -986,10 +978,13 @@ IntPatBlt(
     BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
     BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
 
-    EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
-
     DC_vPrepareDCsForBlit(pdc, DestRect, NULL, DestRect);
 
+    psurf = pdc->dclevel.pSurface;
+
+    if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(pdc);
+
     ret = IntEngBitBlt(
         &psurf->SurfObj,
         NULL,
@@ -999,12 +994,10 @@ IntPatBlt(
         &DestRect,
         NULL,
         NULL,
-        &eboFill.BrushObject, // use pDC->eboFill
+        &pdc->eboFill.BrushObject,
         &BrushOrigin,
         ROP3_TO_ROP4(dwRop));
 
-    EBRUSHOBJ_vCleanup(&eboFill);
-
     DC_vFinishBlit(pdc, NULL);
 
     return ret;