[ros-diffs] [tkreuzer] 41855: [win32k] Implement brush realization part 1 / 2 - Fix BRUSHOBJ_pvGetRbrush, it's supposed to provide a realization, when there is none. For this reason call ENRUSHOBJ_bRealizeBrush, that will call Eng/DrvRealizeBrush to create a realisation. The old implementation never did this and I wonder how 3rd party display drivers were expected to work correctly without this. - Implement EBRUSHOBJ_pvGetEngBrush working similar to BRUSHOBJ_pvGetRbrush, but providing the engbrush as GDI's realization. It's currently implemented as a handle to a translated pattern and not used anywhere yet. - Rename EBRUSHOBJ_vUnrealizeBrus to EBRUSHOBJ_vCleanup. This function now needs to be called to free the resources for a BRUSHOBJECT that GDI or a driver might have allocated. This is done in DC_Cleanup before deleting the DC and in EBRUSHOBJ_vUpdate before newly initializing it. - Get rid of the EBRUSHOBJ's XlateObject, instead for now create new XLATEOBJ's whenever needed. Don't worry these will be gone, as soon as we make use of the engbrush. - Pass a pointer to the DC to EBRUSHOBJ_vInit, as this allows us to save stuff like the back and fore color. - Fix a bitmap leak: CallDibStretchBlt returned before releasing the reference to the pattern surface. - Some FASTCALL -> NTAPI changes - tested with VBE, VMWare-Tools and VBox driver - I hope I didn't forget anything

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Jul 11 01:44:06 CEST 2009


Author: tkreuzer
Date: Sat Jul 11 03:44:05 2009
New Revision: 41855

URL: http://svn.reactos.org/svn/reactos?rev=41855&view=rev
Log:
[win32k] Implement brush realization part 1 / 2
- Fix BRUSHOBJ_pvGetRbrush, it's supposed to provide a realization, when there is none. For this reason call ENRUSHOBJ_bRealizeBrush, that will call Eng/DrvRealizeBrush to create a realisation. The old implementation never did this and I wonder how 3rd party display drivers were expected to work correctly without this.
- Implement EBRUSHOBJ_pvGetEngBrush working similar to BRUSHOBJ_pvGetRbrush, but providing the engbrush as GDI's realization. It's currently implemented as a handle to a translated pattern and not used anywhere yet.
- Rename EBRUSHOBJ_vUnrealizeBrus to EBRUSHOBJ_vCleanup. This function now needs to be called to free the resources for a BRUSHOBJECT that GDI or a driver might have allocated. This is done in DC_Cleanup before deleting the DC and in EBRUSHOBJ_vUpdate before newly initializing it.
- Get rid of the EBRUSHOBJ's XlateObject, instead for now create new XLATEOBJ's whenever needed. Don't worry these will be gone, as soon as we make use of the engbrush.
- Pass a pointer to the DC to EBRUSHOBJ_vInit, as this allows us to save stuff like the back and fore color.
- Fix a bitmap leak: CallDibStretchBlt returned before releasing the reference to the pattern surface.
- Some FASTCALL -> NTAPI changes
- tested with VBE, VMWare-Tools and VBox driver
- I hope I didn't forget anything

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/bitblt.c
    trunk/reactos/subsystems/win32/win32k/eng/engbrush.c
    trunk/reactos/subsystems/win32/win32k/eng/stretchblt.c
    trunk/reactos/subsystems/win32/win32k/eng/xlate.c
    trunk/reactos/subsystems/win32/win32k/include/brush.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/bitblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/bitblt.c?rev=41855&r1=41854&r2=41855&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Sat Jul 11 03:44:05 2009
@@ -50,6 +50,7 @@
     PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
     XLATEOBJ *XlateObj;
     ULONG Pattern = 0;
+    SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
 
     if (psoMask == NULL)
     {
@@ -78,7 +79,9 @@
     fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
     if (psurfPattern)
     {
-        XlateObj = pebo->XlateObject;
+        XlateObj = IntCreateBrushXlate(pebo->pbrush,
+                                       psurfDest,
+                                       pebo->crCurrentBack);
         PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
         if (PatternY < 0)
         {
@@ -113,6 +116,9 @@
             PatternY++;
             PatternY %= PatternHeight;
         }
+
+        if (XlateObj)
+            EngDeleteXlate(XlateObj);
     }
     else
     {
@@ -177,6 +183,8 @@
     PEBRUSHOBJ GdiBrush = NULL;
     SURFACE *psurfPattern;
     BOOLEAN Result;
+    SURFACE *psurfDest = CONTAINING_RECORD(OutputObj, SURFACE, SurfObj);
+    XLATEOBJ *XlatePatternToDest = NULL;
 
     BltInfo.DestSurface = OutputObj;
     BltInfo.SourceSurface = InputObj;
@@ -205,7 +213,10 @@
         {
             /* FIXME - What to do here? */
         }
-        BltInfo.XlatePatternToDest = GdiBrush->XlateObject;
+        XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
+                                                 psurfDest,
+                                                 GdiBrush->crCurrentBack);
+        BltInfo.XlatePatternToDest = XlatePatternToDest;
     }
     else
     {
@@ -213,6 +224,9 @@
     }
 
     Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
+
+    if (XlatePatternToDest)
+        EngDeleteXlate(XlatePatternToDest);
 
     /* Pattern brush */
     if (psurfPattern != NULL)

Modified: trunk/reactos/subsystems/win32/win32k/eng/engbrush.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/engbrush.c?rev=41855&r1=41854&r2=41855&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] Sat Jul 11 03:44:05 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
  * PURPOSE:           GDI Driver Brush Functions
@@ -34,8 +34,6 @@
     RECTL rclDest;
     ULONG lWidth;
 
-    rclDest = (RECTL){0, 0, psoPattern->sizlBitmap.cx, psoPattern->sizlBitmap.cy};
-
     /* Calculate width in bytes of the realized brush */
     lWidth = DIB_GetDIBWidthBytes(psoPattern->sizlBitmap.cx,
                                   BitsPerFormat(psoDst->iBitmapFormat));
@@ -60,6 +58,7 @@
     }
 
     /* Copy the bits to the new format bitmap */
+    rclDest = (RECTL){0, 0, psoPattern->sizlBitmap.cx, psoPattern->sizlBitmap.cy};
     EngCopyBits(psoRealize, psoPattern, NULL, pxlo, &rclDest, &ptlSrc);
 
     /* Unlock the bitmap again */
@@ -72,13 +71,27 @@
 }
 
 VOID
-FASTCALL
-EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo)
+NTAPI
+EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
 {
     ULONG iSolidColor;
+    XLATEOBJ *pxlo;
+    PSURFACE psurfTrg;
 
     ASSERT(pebo);
     ASSERT(pbrush);
+    ASSERT(pdc);
+
+    psurfTrg = pdc->dclevel.pSurface;
+
+    pebo->psurfTrg = psurfTrg;
+    pebo->BrushObject.flColorType = 0;
+    pebo->pbrush = pbrush;
+    pebo->flattrs = pbrush->flAttrs;
+    pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
+    pebo->crCurrentBack = pdc->pdcattr->crBackgroundClr;
+    pebo->BrushObject.pvRbrush = NULL;
+    pebo->pengbrush = NULL;
 
     if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
     {
@@ -91,22 +104,17 @@
         pebo->ulRGBColor = pbrush->BrushAttr.lbColor;
 
         /* Translate the brush color to the target format */
+        pxlo = IntCreateBrushXlate(pbrush, psurfTrg, pebo->crCurrentBack);
         iSolidColor = XLATEOBJ_iXlate(pxlo, pbrush->BrushAttr.lbColor);
         pebo->BrushObject.iSolidColor = iSolidColor;
+        if (pxlo)
+            EngDeleteXlate(pxlo);
     }
     else
     {
         /* This is a pattern brush that needs realization */
         pebo->BrushObject.iSolidColor = 0xFFFFFFFF;
-//        EBRUSHOBJ_bRealizeBrush(pebo);
-    }
-
-//    pebo->psurfTrg = psurfTrg;
-    pebo->BrushObject.pvRbrush = pbrush->ulRealization;
-    pebo->BrushObject.flColorType = 0;
-    pebo->pbrush = pbrush;
-    pebo->flattrs = pbrush->flAttrs;
-    pebo->XlateObject = pxlo;
+    }
 }
 
 VOID
@@ -130,39 +138,53 @@
 }
 
 BOOL
-FASTCALL
+NTAPI
 EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo)
 {
     BOOL bResult;
-    PFN_DrvRealizeBrush pfnRealzizeBrush;
+    PFN_DrvRealizeBrush pfnRealzizeBrush = NULL;
     PSURFACE psurfTrg, psurfPattern, psurfMask;
-    PPDEVOBJ ppdev;
+    PPDEVOBJ ppdev = NULL;
     XLATEOBJ *pxlo;
 
     psurfTrg = pebo->psurfTrg; // FIXME: all EBRUSHOBJs need a surface
+    if (!psurfTrg)
+    {
+        DPRINT1("Pattern brush has no target surface!\n");
+        return FALSE;
+    }
+
     ppdev = (PPDEVOBJ)psurfTrg->SurfObj.hdev; // FIXME: all SURFACEs need a PDEV
-
-    pfnRealzizeBrush = NULL;//ppdev->DriverFunctions.RealizeBrush;
+    if (ppdev)
+        pfnRealzizeBrush = ppdev->DriverFunctions.RealizeBrush;
     if (!pfnRealzizeBrush)
     {
         pfnRealzizeBrush = EngRealizeBrush;
     }
 
     psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
+    if (!psurfPattern)
+    {
+        DPRINT1("No pattern, nothing to realize!\n");
+        return FALSE;
+    }
 
     /* FIXME: implement mask */
     psurfMask = NULL;
 
-    // FIXME
-    pxlo = NULL;
-
-    bResult = pfnRealzizeBrush(&pebo->BrushObject, 
+    /* Create xlateobj for the brush */
+    pxlo = IntCreateBrushXlate(pebo->pbrush, psurfTrg, pebo->crCurrentBack);
+
+    /* Perform the realization */
+    bResult = pfnRealzizeBrush(&pebo->BrushObject,
                                &pebo->psurfTrg->SurfObj,
-                               psurfPattern ? &psurfPattern->SurfObj : NULL,
+                               &psurfPattern->SurfObj,
                                psurfMask ? &psurfMask->SurfObj : NULL,
                                pxlo,
                                -1); // FIXME: what about hatch brushes?
 
+    EngDeleteXlate(pxlo);
+
     if (psurfPattern)
         SURFACE_UnlockSurface(psurfPattern);
 
@@ -173,33 +195,55 @@
 }
 
 VOID
-FASTCALL
-EBRUSHOBJ_vUnrealizeBrush(EBRUSHOBJ *pebo)
-{
-    /* Check if it's a GDI realisation */
+NTAPI
+EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
+{
+    /* Check if there's a GDI realisation */
     if (pebo->pengbrush)
     {
         EngDeleteSurface(pebo->pengbrush);
-    }
-    else if (pebo->BrushObject.pvRbrush)
+        pebo->pengbrush = NULL;
+    }
+
+    /* Check if there's a driver's realisation */
+    if (pebo->BrushObject.pvRbrush)
     {
         /* Free allocated driver memory */
         EngFreeMem(pebo->BrushObject.pvRbrush);
-    }
-}
-
-
-
-VOID
-FASTCALL
-EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo)
-{
-    /* Unrealize the brush */
-    EBRUSHOBJ_vUnrealizeBrush(pebo);
-
-    EBRUSHOBJ_vInit(pebo, pbrush, pxlo);
-}
-
+        pebo->BrushObject.pvRbrush = NULL;
+    }
+}
+
+VOID
+NTAPI
+EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
+{
+    /* Cleanup the brush */
+//    EBRUSHOBJ_vCleanup(pebo);
+
+    /* Reinitialize */
+    EBRUSHOBJ_vInit(pebo, pbrush, pdc);
+}
+
+PVOID
+NTAPI
+EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo)
+{
+    BOOL bResult;
+
+    if (!pebo->pengbrush)
+    {
+        bResult = EBRUSHOBJ_bRealizeBrush(pebo);
+        if (!bResult)
+        {
+            if (pebo->pengbrush)
+                EngDeleteSurface(pebo->pengbrush);
+            pebo->pengbrush = NULL;
+        }
+    }
+
+    return pebo->pengbrush;
+}
 
 
 /** Exported DDI functions ****************************************************/
@@ -223,7 +267,20 @@
 BRUSHOBJ_pvGetRbrush(
     IN BRUSHOBJ *pbo)
 {
-    // FIXME: this is wrong! Read msdn.
+    EBRUSHOBJ *pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
+    BOOL bResult;
+
+    if (!pbo->pvRbrush)
+    {
+        bResult = EBRUSHOBJ_bRealizeBrush(pebo);
+        if (!bResult)
+        {
+            if (pbo->pvRbrush)
+                EngFreeMem(pbo->pvRbrush);
+            pbo->pvRbrush = NULL;
+        }
+    }
+
     return pbo->pvRbrush;
 }
 

Modified: trunk/reactos/subsystems/win32/win32k/eng/stretchblt.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/stretchblt.c?rev=41855&r1=41854&r2=41855&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1] Sat Jul 11 03:44:05 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * PURPOSE:          GDI stretch blt functions
@@ -39,6 +39,8 @@
     PEBRUSHOBJ GdiBrush = NULL;
     SURFOBJ* PatternSurface = NULL;
     XLATEOBJ* XlatePatternToDest = NULL;
+    BOOL bResult;
+    SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
 
     if (BrushOrigin == NULL)
     {
@@ -62,23 +64,32 @@
         {
             /* FIXME - What to do here? */
         }
-        XlatePatternToDest = GdiBrush->XlateObject;
+        XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
+                                                 psurfDest,
+                                                 GdiBrush->crCurrentBack);
     }
     else
     {
         psurfPattern = NULL;
     }
 
-    return DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
-               psoDest, psoSource, Mask, PatternSurface, 
-               OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin, 
+    bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
+               psoDest, psoSource, Mask, PatternSurface,
+               OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
                ColorTranslation, XlatePatternToDest, Rop4);
+
+    if (XlatePatternToDest)
+    {
+        EngDeleteXlate(XlatePatternToDest);
+    }
 
     /* Pattern brush */
     if (psurfPattern)
     {
         SURFACE_UnlockSurface(psurfPattern);
     }
+
+    return bResult;
 }
 
 

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=41855&r1=41854&r2=41855&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] Sat Jul 11 03:44:05 2009
@@ -689,13 +689,11 @@
 
 // HACK!
 XLATEOBJ*
-IntCreateBrushXlate(PDC pdc, BRUSH *pbrush)
-{
-    SURFACE * psurf;
+IntCreateBrushXlate(BRUSH *pbrush, SURFACE * psurf, COLORREF crBackgroundClr)
+{
     XLATEOBJ *pxlo = NULL;
     HPALETTE hPalette = NULL;
 
-    psurf = pdc->dclevel.pSurface;
     if (psurf)
     {
         hPalette = psurf->hDIBPalette;
@@ -719,10 +717,9 @@
         /* Special case: 1bpp pattern */
         if (psurfPattern->SurfObj.iBitmapFormat == BMF_1BPP)
         {
-            if (pdc->rosdc.bitsPerPixel != 1)
-                pxlo = IntEngCreateSrcMonoXlate(hPalette,
-                                                pdc->pdcattr->crBackgroundClr,
-                                                pbrush->BrushAttr.lbColor);
+            pxlo = IntEngCreateSrcMonoXlate(hPalette,
+                                            crBackgroundClr,
+                                            pbrush->BrushAttr.lbColor);
         }
         else if (pbrush->flAttrs & GDIBRUSH_IS_DIB)
         {

Modified: trunk/reactos/subsystems/win32/win32k/include/brush.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/brush.h?rev=41855&r1=41854&r2=41855&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/brush.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/brush.h [iso-8859-1] Sat Jul 11 03:44:05 2009
@@ -67,9 +67,6 @@
     DWORD       ulUnique;
 //    DWORD       dwUnknown54;
 //    DWORD       dwUnknown58;
-
-    /* Ros specific */
-    XLATEOBJ *XlateObject;
 } EBRUSHOBJ, *PEBRUSHOBJ;
 
 /* GDI Brush Attributes */
@@ -105,19 +102,26 @@
 INT FASTCALL BRUSH_GetObject (PBRUSH GdiObject, INT Count, LPLOGBRUSH Buffer);
 BOOL INTERNAL_CALL BRUSH_Cleanup(PVOID ObjectBody);
 
-VOID FASTCALL
-EBRUSHOBJ_vInit(EBRUSHOBJ *BrushInst, PBRUSH BrushObj, XLATEOBJ *XlateObj);
+struct _DC;
+
+VOID
+NTAPI
+EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *);
 
 VOID
 FASTCALL
 EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor, XLATEOBJ *pxlo);
 
 VOID
-FASTCALL
-EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo);
+NTAPI
+EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *pdc);
 
 BOOL
-FASTCALL
+NTAPI
 EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo);
 
+VOID
+NTAPI
+EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
+
 #endif

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=41855&r1=41854&r2=41855&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] Sat Jul 11 03:44:05 2009
@@ -110,7 +110,7 @@
                          ULONG Color1);
 
 XLATEOBJ*
-IntCreateBrushXlate(PDC pdc, BRUSH *pbrush);
+IntCreateBrushXlate(BRUSH *pbrush, SURFACE * psurf, COLORREF crBackgroundClr);
 
 HPALETTE FASTCALL
 IntEngGetXlatePalette(XLATEOBJ *XlateObj,

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=41855&r1=41854&r2=41855&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] Sat Jul 11 03:44:05 2009
@@ -941,7 +941,6 @@
     EBRUSHOBJ eboFill;
     POINTL BrushOrigin;
     BOOL ret;
-    XLATEOBJ *pxlo;
 
     ASSERT(pbrush);
 
@@ -989,8 +988,7 @@
     BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
     BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
 
-    pxlo = IntCreateBrushXlate(pdc, pbrush);
-    EBRUSHOBJ_vInit(&eboFill, pbrush, pxlo);
+    EBRUSHOBJ_vInit(&eboFill, pbrush, pdc);
 
     ret = IntEngBitBlt(
         &psurf->SurfObj,
@@ -1005,7 +1003,7 @@
         &BrushOrigin,
         ROP3_TO_ROP4(dwRop));
 
-    EngDeleteXlate(pxlo);
+    EBRUSHOBJ_vCleanup(&eboFill);
 
     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=41855&r1=41854&r2=41855&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] Sat Jul 11 03:44:05 2009
@@ -100,21 +100,21 @@
     /* Create the default fill brush */
     pdcattr->hbrush = NtGdiGetStockObject(WHITE_BRUSH);
     NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
-    EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL);
+    EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NewDC);
 
     /* Create the default pen / line brush */
     pdcattr->hpen = NtGdiGetStockObject(BLACK_PEN);
     NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen);
-    EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrLine, NULL);
+    EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrLine, NewDC);
 
     /* Create the default text brush */
     pbrush = BRUSH_ShareLockBrush(NtGdiGetStockObject(BLACK_BRUSH));
-    EBRUSHOBJ_vInit(&NewDC->eboText, pbrush, NULL);
+    EBRUSHOBJ_vInit(&NewDC->eboText, pbrush, NewDC);
     pdcattr->ulDirty_ |= DIRTY_TEXT;
 
     /* Create the default background brush */
     pbrush = BRUSH_ShareLockBrush(NtGdiGetStockObject(WHITE_BRUSH));
-    EBRUSHOBJ_vInit(&NewDC->eboBackground, pbrush, NULL);
+    EBRUSHOBJ_vInit(&NewDC->eboBackground, pbrush, NewDC);
 
     pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
     TextIntRealizeFont(pdcattr->hlfntNew,NULL);
@@ -161,6 +161,12 @@
     /* Dereference default brushes */
     BRUSH_ShareUnlockBrush(pDC->eboText.pbrush);
     BRUSH_ShareUnlockBrush(pDC->eboBackground.pbrush);
+
+    /* Cleanup the dc brushes */
+    EBRUSHOBJ_vCleanup(&pDC->eboFill);
+    EBRUSHOBJ_vCleanup(&pDC->eboLine);
+    EBRUSHOBJ_vCleanup(&pDC->eboText);
+    EBRUSHOBJ_vCleanup(&pDC->eboBackground);
 
     return TRUE;
 }

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=41855&r1=41854&r2=41855&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] Sat Jul 11 03:44:05 2009
@@ -41,7 +41,9 @@
     }
 
     /* ROS HACK, should use surf xlate */
-    pxlo = IntCreateBrushXlate(pdc, pdc->dclevel.pbrFill);
+    pxlo = IntCreateBrushXlate(pdc->dclevel.pbrFill,
+                               pdc->dclevel.pSurface,
+                               pdc->pdcattr->crBackgroundClr);
 
     /* Check if the EBRUSHOBJ needs update */
     if (pdcattr->ulDirty_ & DIRTY_FILL)
@@ -49,7 +51,7 @@
         pbrFill = pdc->dclevel.pbrFill;
 
         /* Update eboFill, realizing it, if needed */
-        EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pxlo);
+        EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pdc);
     }
 
     /* Check for DC brush */
@@ -95,7 +97,9 @@
     }
 
     /* ROS HACK, should use surf xlate */
-    pxlo = IntCreateBrushXlate(pdc, pdc->dclevel.pbrFill);
+    pxlo = IntCreateBrushXlate(pdc->dclevel.pbrFill,
+                               pdc->dclevel.pSurface,
+                               pdc->pdcattr->crBackgroundClr);
 
     /* Check if the EBRUSHOBJ needs update */
     if (pdcattr->ulDirty_ & DIRTY_LINE)
@@ -103,7 +107,7 @@
         pbrLine = pdc->dclevel.pbrLine;
 
         /* Update eboLine, realizing it, if needed */
-        EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pxlo);
+        EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pdc);
     }
 
     /* Check for DC pen */
@@ -177,8 +181,8 @@
     pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND;
 }
 
-HPALETTE 
-FASTCALL 
+HPALETTE
+FASTCALL
 GdiSelectPalette(
     HDC hDC,
     HPALETTE hpal,
@@ -331,7 +335,7 @@
     // If Info DC this is zero and pSurface is moved to DC->pSurfInfo.
     psurfBmp->hDC = hDC;
 
-    // if we're working with a DIB, get the palette 
+    // if we're working with a DIB, get the palette
     // [fixme: only create if the selected palette is null]
     if (psurfBmp->hSecure)
     {



More information about the Ros-diffs mailing list