Author: tkreuzer
Date: Mon Apr  6 03:51:27 2009
New Revision: 40381

URL: http://svn.reactos.org/svn/reactos?rev=40381&view=rev
Log:
- Update the EBRUSHOBJ independent of changing the brush/pen handle in 
DC_vUpdateFill/LineBrush
- Mark the brushes as dirty after change of surface, palette and DIB colot table
- Update the EBURHOBJs on demand in IntGdiPolygon and IntRectangle
- Fixes bug 4340
See issue #4340 for more details.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
    trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
    trunk/reactos/subsystems/win32/win32k/objects/fillshap.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c?rev=40381&r1=40380&r2=40381&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Mon Apr 
 6 03:51:27 2009
@@ -85,11 +85,8 @@
             BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill);
             pdc->dclevel.pbrFill = pbrFill;
 
-            /* ROS HACK, should use surf xlate */
-            IntUpdateBrushXlate(pdc, &pdc->rosdc.XlateBrush, pbrFill);
-
-            /* Update eboFill, realizing it, if needed */
-            EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pdc->rosdc.XlateBrush);
+            /* Mark eboFill as dirty */
+            pdcattr->ulDirty_ |= DIRTY_FILL;
         }
         else
         {
@@ -98,12 +95,24 @@
         }
     }
 
-    /* ROS HACK, should use surf xlate */
-    pxlo = pdc->rosdc.XlateBrush;
+    /* Check if the EBRUSHOBJ needs update */
+    if (pdcattr->ulDirty_ & DIRTY_FILL)
+    {
+        pbrFill = pdc->dclevel.pbrFill;
+
+        /* ROS HACK, should use surf xlate */
+        IntUpdateBrushXlate(pdc, &pdc->rosdc.XlateBrush, pbrFill);
+
+        /* Update eboFill, realizing it, if needed */
+        EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pdc->rosdc.XlateBrush);
+    }
 
     /* Check for DC brush */
     if (pdcattr->hbrush == StockObjects[DC_BRUSH])
     {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlateBrush;
+
         /* Update the eboFill's solid color */
         EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboFill, pdcattr->crPenClr, pxlo);
     }
@@ -131,11 +140,8 @@
             BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine);
             pdc->dclevel.pbrLine = pbrLine;
 
-            /* ROS HACK, should use surf xlate */
-            IntUpdateBrushXlate(pdc, &pdc->rosdc.XlatePen, pbrLine);
-
-            /* Update eboLine, realizing it, if needed */
-            EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pdc->rosdc.XlatePen);
+            /* Mark eboLine as dirty */
+            pdcattr->ulDirty_ |= DIRTY_LINE;
         }
         else
         {
@@ -144,12 +150,24 @@
         }
     }
 
-    /* ROS HACK, should use surf xlate */
-    pxlo = pdc->rosdc.XlatePen;
+    /* Check if the EBRUSHOBJ needs update */
+    if (pdcattr->ulDirty_ & DIRTY_LINE)
+    {
+        pbrLine = pdc->dclevel.pbrLine;
+
+        /* ROS HACK, should use surf xlate */
+        IntUpdateBrushXlate(pdc, &pdc->rosdc.XlatePen, pbrLine);
+
+        /* Update eboLine, realizing it, if needed */
+        EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pdc->rosdc.XlatePen);
+    }
 
     /* Check for DC pen */
     if (pdcattr->hpen == StockObjects[DC_PEN])
     {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlatePen;
+
         /* Update the eboLine's solid color */
         EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboLine, pdcattr->crPenClr, pxlo);
     }
@@ -250,13 +268,13 @@
     if ((pdc->rosdc.bitsPerPixel <= 8 && ppal->Mode == PAL_INDEXED) ||
         (pdc->rosdc.bitsPerPixel > 8  && ppal->Mode != PAL_INDEXED))
     {
+        /* Get old palette, set new one */
         oldPal = pdc->dclevel.hpal;
         pdc->dclevel.hpal = hpal;
-    }
-    else if (pdc->rosdc.bitsPerPixel > 8 && ppal->Mode == PAL_INDEXED)
-    {
-        oldPal = pdc->dclevel.hpal;
-        pdc->dclevel.hpal = hpal;
+
+        /* Mark the brushes invalid */
+        pdc->pdcattr->ulDirty_ |= DIRTY_FILL | DIRTY_LINE |
+                                  DIRTY_BACKGROUND | DIRTY_TEXT;
     }
 
     PALETTE_UnlockPalette(ppal);
@@ -382,7 +400,6 @@
     HBITMAP hOrgBmp;
     PSURFACE psurfBmp, psurfOld;
     HRGN hVisRgn;
-    PBRUSH pbrush;
 
     if (hDC == NULL || hBmp == NULL) return NULL;
 
@@ -443,20 +460,8 @@
     /* Release the exclusive lock */
     SURFACE_UnlockSurface(psurfBmp);
 
-    /* Regenerate the XLATEOBJs. (hack!) */
-    pbrush = BRUSH_LockBrush(pdcattr->hbrush);
-    if (pbrush)
-    {
-        IntUpdateBrushXlate(pDC, &pDC->rosdc.XlateBrush, pbrush);
-        BRUSH_UnlockBrush(pbrush);
-    }
-
-    pbrush = PEN_LockPen(pdcattr->hpen);
-    if (pbrush)
-    {
-        IntUpdateBrushXlate(pDC, &pDC->rosdc.XlatePen, pbrush);
-        PEN_UnlockPen(pbrush);
-    }
+    /* Mark the brushes invalid */
+    pdcattr->ulDirty_ |= DIRTY_FILL | DIRTY_LINE;
 
     DC_UnlockDc(pDC);
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dibobj.c?rev=40381&r1=40380&r2=40381&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Mon Apr 
 6 03:51:27 2009
@@ -128,6 +128,9 @@
    }
    else
       Entries = 0;
+
+   /* Mark the brushes invalid */
+   dc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE|DIRTY_BACKGROUND|DIRTY_TEXT;
 
    SURFACE_UnlockSurface(psurf);
    DC_UnlockDc(dc);

Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/fillshap.c?rev=40381&r1=40380&r2=40381&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Mon 
Apr  6 03:51:27 2009
@@ -87,11 +87,11 @@
             DestRect.bottom   = max(DestRect.bottom, Points[CurrentPoint].y);
         }
 
-        if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY)
-           IntGdiSelectBrush(dc,pdcattr->hbrush);
-
-        if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
-           IntGdiSelectPen(dc,pdcattr->hpen);
+        if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+            DC_vUpdateFillBrush(dc);
+
+        if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
+            DC_vUpdateLineBrush(dc);
 
         /* Special locking order to avoid lock-ups */
         pbrFill = dc->dclevel.pbrFill;
@@ -568,11 +568,11 @@
         DestRect.bottom--;
     }
 
-    if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY)
-       IntGdiSelectBrush(dc,pdcattr->hbrush);
-
-    if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
-       IntGdiSelectPen(dc,pdcattr->hpen);
+    if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
+        DC_vUpdateFillBrush(dc);
+
+    if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
+        DC_vUpdateLineBrush(dc);
 
     pbrFill = dc->dclevel.pbrFill;
     pbrLine = dc->dclevel.pbrLine;

Reply via email to