[ros-diffs] [tkreuzer] 41820: Get rid of the DCs XlateBrush and XlatePen. The resulting code isn't any better yet, but this step is needed for the upcoming xlateobj rewrite.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Jul 8 23:53:36 CEST 2009


Author: tkreuzer
Date: Thu Jul  9 01:53:35 2009
New Revision: 41820

URL: http://svn.reactos.org/svn/reactos?rev=41820&view=rev
Log:
Get rid of the DCs XlateBrush and XlatePen. The resulting code isn't any better yet, but this step is needed for the upcoming xlateobj rewrite.

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/xlate.c
    trunk/reactos/subsystems/win32/win32k/include/dc.h
    trunk/reactos/subsystems/win32/win32k/include/inteng.h
    trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
    trunk/reactos/subsystems/win32/win32k/objects/dclife.c
    trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c

Modified: trunk/reactos/subsystems/win32/win32k/eng/xlate.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/xlate.c?rev=41820&r1=41819&r2=41820&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] Thu Jul  9 01:53:35 2009
@@ -671,4 +671,53 @@
    return 0;
 }
 
+// HACK!
+XLATEOBJ*
+IntCreateBrushXlate(PDC pdc, BRUSH *pbrush)
+{
+    SURFACE * psurf;
+    XLATEOBJ *pxlo = NULL;
+    HPALETTE hPalette = NULL;
+
+    psurf = pdc->dclevel.pSurface;
+    if (psurf)
+    {
+        hPalette = psurf->hDIBPalette;
+    }
+    if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault;
+
+    if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
+    {
+        pxlo = NULL;
+    }
+    else if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
+    {
+        pxlo = IntEngCreateXlate(0, PAL_RGB, hPalette, NULL);
+    }
+    else
+    {
+        SURFACE *psurfPattern = SURFACE_LockSurface(pbrush->hbmPattern);
+        if (psurfPattern == NULL)
+            return FALSE;
+
+        /* Special case: 1bpp pattern */
+        if (psurfPattern->SurfObj.iBitmapFormat == BMF_1BPP)
+        {
+            if (pdc->rosdc.bitsPerPixel != 1)
+                pxlo = IntEngCreateSrcMonoXlate(hPalette,
+                                                pdc->pdcattr->crBackgroundClr,
+                                                pbrush->BrushAttr.lbColor);
+        }
+        else if (pbrush->flAttrs & GDIBRUSH_IS_DIB)
+        {
+            pxlo = IntEngCreateXlate(0, 0, hPalette, psurfPattern->hDIBPalette);
+        }
+
+        SURFACE_UnlockSurface(psurfPattern);
+    }
+
+    return pxlo;
+}
+
+
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/dc.h?rev=41820&r1=41819&r2=41820&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Thu Jul  9 01:53:35 2009
@@ -21,8 +21,6 @@
   BYTE   bitsPerPixel;
 
   CLIPOBJ     *CombinedClip;
-  XLATEOBJ    *XlateBrush;
-  XLATEOBJ    *XlatePen;
 
   UNICODE_STRING    DriverName;
 

Modified: trunk/reactos/subsystems/win32/win32k/include/inteng.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/inteng.h?rev=41820&r1=41819&r2=41820&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/inteng.h [iso-8859-1] Thu Jul  9 01:53:35 2009
@@ -107,6 +107,9 @@
                          ULONG Color0,
                          ULONG Color1);
 
+XLATEOBJ*
+IntCreateBrushXlate(PDC pdc, BRUSH *pbrush);
+
 HPALETTE FASTCALL
 IntEngGetXlatePalette(XLATEOBJ *XlateObj,
                       ULONG Palette);

Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/bitblt.c?rev=41820&r1=41819&r2=41820&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Thu Jul  9 01:53:35 2009
@@ -941,6 +941,7 @@
     EBRUSHOBJ eboFill;
     POINTL BrushOrigin;
     BOOL ret;
+    XLATEOBJ *pxlo;
 
     ASSERT(pbrush);
 
@@ -988,7 +989,8 @@
     BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
     BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
 
-    EBRUSHOBJ_vInit(&eboFill, pbrush, pdc->rosdc.XlateBrush);
+    pxlo = IntCreateBrushXlate(pdc, pbrush);
+    EBRUSHOBJ_vInit(&eboFill, pbrush, pxlo);
 
     ret = IntEngBitBlt(
         &psurf->SurfObj,
@@ -1002,6 +1004,8 @@
         &eboFill.BrushObject, // use pDC->eboFill
         &BrushOrigin,
         ROP3_TO_ROP4(dwRop));
+
+    EngDeleteXlate(pxlo);
 
     return ret;
 }

Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dclife.c?rev=41820&r1=41819&r2=41820&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Thu Jul  9 01:53:35 2009
@@ -500,10 +500,6 @@
         NtGdiSelectBrush (DCHandle, STOCK_WHITE_BRUSH);
         NtGdiSelectFont (DCHandle, STOCK_SYSTEM_FONT);
         DC_LockDC (DCHandle); NtGdiSelectXxx does not recognize stock objects yet  */
-        if (DCToDelete->rosdc.XlateBrush != NULL)
-            EngDeleteXlate(DCToDelete->rosdc.XlateBrush);
-        if (DCToDelete->rosdc.XlatePen != NULL)
-            EngDeleteXlate(DCToDelete->rosdc.XlatePen);
     }
     if (DCToDelete->rosdc.hClipRgn)
     {
@@ -719,7 +715,7 @@
           return GreDeleteObject((HGDIOBJ) DCHandle);
 
         default:
-          return FALSE; 
+          return FALSE;
      }
   }
   return (DCHandle != NULL);

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=41820&r1=41819&r2=41820&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] Thu Jul  9 01:53:35 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
  * PURPOSE:           Functions for creation and destruction of DCs
@@ -10,60 +10,6 @@
 
 #define NDEBUG
 #include <debug.h>
-
-// HACK!
-static
-BOOLEAN
-IntUpdateBrushXlate(PDC pdc, XLATEOBJ **ppxlo, BRUSH *pbrush)
-{
-    SURFACE * psurf;
-    XLATEOBJ *pxlo = NULL;
-    HPALETTE hPalette = NULL;
-
-    psurf = pdc->dclevel.pSurface;
-    if (psurf)
-    {
-        hPalette = psurf->hDIBPalette;
-    }
-    if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault;
-
-    if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
-    {
-        pxlo = NULL;
-    }
-    else if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
-    {
-        pxlo = IntEngCreateXlate(0, PAL_RGB, hPalette, NULL);
-    }
-    else
-    {
-        SURFACE *psurfPattern = SURFACE_LockSurface(pbrush->hbmPattern);
-        if (psurfPattern == NULL)
-            return FALSE;
-
-        /* Special case: 1bpp pattern */
-        if (psurfPattern->SurfObj.iBitmapFormat == BMF_1BPP)
-        {
-            if (pdc->rosdc.bitsPerPixel != 1)
-                pxlo = IntEngCreateSrcMonoXlate(hPalette,
-                                                pdc->pdcattr->crBackgroundClr,
-                                                pbrush->BrushAttr.lbColor);
-        }
-        else if (pbrush->flAttrs & GDIBRUSH_IS_DIB)
-        {
-            pxlo = IntEngCreateXlate(0, 0, hPalette, psurfPattern->hDIBPalette);
-        }
-
-        SURFACE_UnlockSurface(psurfPattern);
-    }
-
-    if (*ppxlo != NULL)
-        EngDeleteXlate(*ppxlo);
-
-    *ppxlo = pxlo;
-    return TRUE;
-}
-
 
 VOID
 FASTCALL
@@ -94,27 +40,26 @@
         }
     }
 
+    /* ROS HACK, should use surf xlate */
+    pxlo = IntCreateBrushXlate(pdc, pdc->dclevel.pbrFill);
+
     /* 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);
+        EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pxlo);
     }
 
     /* 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);
     }
+
+    EngDeleteXlate(pxlo);
 
     /* Clear flags */
     pdcattr->ulDirty_ &= ~(DIRTY_FILL | DC_BRUSH_DIRTY);
@@ -149,27 +94,26 @@
         }
     }
 
+    /* ROS HACK, should use surf xlate */
+    pxlo = IntCreateBrushXlate(pdc, pdc->dclevel.pbrFill);
+
     /* 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);
+        EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pxlo);
     }
 
     /* 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);
     }
+
+    EngDeleteXlate(pxlo);
 
     /* Clear flags */
     pdcattr->ulDirty_ &= ~(DIRTY_LINE | DC_PEN_DIRTY);
@@ -434,7 +378,7 @@
     BOOL  success = FALSE;
     PDC_ATTR pdcattr;
     PDC pdc;
-    
+
     pdc = DC_LockDc(hDC);
     if (!pdc)
     {



More information about the Ros-diffs mailing list