[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Tue, 20 Apr 2010 19:31:45 +0000 (19:31 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Tue, 20 Apr 2010 19:31:45 +0000 (19:31 +0000)
  - Revert r46960 : the correct way to go is to mark brushes as dirty and update them where needed
  - Do so in GreExtTextOutW, NtGdiBitBlt, NtGdiStrecthBltMask and IntPatBlt
  - Add a small hack to GreEstTextOutW so we hold the Blit lock when needed without too much pain.

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

subsystems/win32/win32k/objects/bitblt.c
subsystems/win32/win32k/objects/dclife.c
subsystems/win32/win32k/objects/freetype.c

index 95aadff..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,7 +936,6 @@ IntPatBlt(
 {
     RECTL DestRect;
     SURFACE *psurf;
-    EBRUSHOBJ eboFill;
     POINTL BrushOrigin;
     BOOL ret;
 
@@ -983,7 +982,8 @@ IntPatBlt(
 
     psurf = pdc->dclevel.pSurface;
 
-    EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
+    if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(pdc);
 
     ret = IntEngBitBlt(
         &psurf->SurfObj,
@@ -994,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;
index 9440c7c..71d3501 100644 (file)
@@ -478,15 +478,8 @@ DC_vUpdateDC(PDC pdc)
     pdc->flGraphicsCaps = ppdev->devinfo.flGraphicsCaps;
     pdc->flGraphicsCaps2 = ppdev->devinfo.flGraphicsCaps2;
 
-    /* re-Initialize EBRUSHOBJs */
-    EBRUSHOBJ_vCleanup(&pdc->eboFill);
-    EBRUSHOBJ_vInit(&pdc->eboFill, pdc->dclevel.pbrFill, pdc);
-    EBRUSHOBJ_vCleanup(&pdc->eboLine);
-    EBRUSHOBJ_vInit(&pdc->eboLine, pdc->dclevel.pbrLine, pdc);
-    EBRUSHOBJ_vCleanup(&pdc->eboText);
-    EBRUSHOBJ_vInit(&pdc->eboText, pbrDefaultBrush, pdc);
-    EBRUSHOBJ_vCleanup(&pdc->eboBackground);
-    EBRUSHOBJ_vInit(&pdc->eboBackground, pbrDefaultBrush, pdc);
+    /* Mark EBRUSHOBJs as dirty */
+    pdc->pdcattr->ulDirty_ |= DIRTY_DEFAULT ;
 }
 
 /* Prepare a blit for up to 2 DCs */
index d53660c..00da100 100644 (file)
@@ -3153,7 +3153,7 @@ GreExtTextOutW(
     LONGLONG TextLeft, RealXStart;
     ULONG TextTop, previous, BackgroundLeft;
     FT_Bool use_kerning;
-    RECTL DestRect, MaskRect;
+    RECTL DestRect, MaskRect, DummyRect = {0, 0, 0, 0};
     POINTL SourcePoint, BrushOrigin;
     HBITMAP HSourceGlyph;
     SURFOBJ *SourceGlyphSurf;
@@ -3189,9 +3189,6 @@ GreExtTextOutW(
 
     pdcattr = dc->pdcattr;
 
-    if (pdcattr->ulDirty_ & DIRTY_TEXT)
-        DC_vUpdateTextBrush(dc);
-
     if ((fuOptions & ETO_OPAQUE) || pdcattr->jBkMode == OPAQUE)
     {
         if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
@@ -3225,13 +3222,6 @@ GreExtTextOutW(
         IntLPtoDP(dc, (POINT *)lprc, 2);
     }
 
-    psurf = dc->dclevel.pSurface;
-    if (!psurf)
-    {
-        goto fail;
-    }
-    SurfObj = &psurf->SurfObj;
-
     Start.x = XStart;
     Start.y = YStart;
     IntLPtoDP(dc, &Start, 1);
@@ -3262,8 +3252,11 @@ GreExtTextOutW(
 
         DC_vPrepareDCsForBlit(dc, DestRect, NULL, DestRect);
 
+        if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
+            DC_vUpdateBackgroundBrush(dc);
+
         IntEngBitBlt(
-            &psurf->SurfObj,
+            &dc->dclevel.pSurface->SurfObj,
             NULL,
             NULL,
             dc->rosdc.CombinedClip,
@@ -3440,6 +3433,12 @@ GreExtTextOutW(
     TextTop = YStart;
     BackgroundLeft = (RealXStart + 32) >> 6;
 
+    /* Lock blit with a dummy rect */
+    DC_vPrepareDCsForBlit(dc, DummyRect, NULL, DummyRect);
+
+    psurf = dc->dclevel.pSurface ;
+    SurfObj = &psurf->SurfObj ;
+
     /* Create the xlateobj */
     hDestPalette = psurf->hDIBPalette;
     if (!hDestPalette) hDestPalette = pPrimarySurface->devinfo.hpalDefault;
@@ -3450,6 +3449,11 @@ GreExtTextOutW(
     EXLATEOBJ_vInitialize(&exloDst2RGB, ppalDst, &gpalRGB, 0, 0, 0);
     PALETTE_UnlockPalette(ppalDst);
 
+    if ((fuOptions & ETO_OPAQUE) && (dc->pdcattr->ulDirty_ & DIRTY_BACKGROUND))
+        DC_vUpdateBackgroundBrush(dc) ;
+
+    if(dc->pdcattr->ulDirty_ & DIRTY_TEXT)
+        DC_vUpdateTextBrush(dc) ;
 
     /*
      * The main rendering loop.
@@ -3613,6 +3617,7 @@ GreExtTextOutW(
     }
     IntUnLockFreeType;
 
+    DC_vFinishBlit(dc, NULL) ;
     EXLATEOBJ_vCleanup(&exloRGB2Dst);
     EXLATEOBJ_vCleanup(&exloDst2RGB);
     if (TextObj != NULL)