[ros-diffs] [tkreuzer] 40179: Brush rewrite part 1/x - Make the EBRUSHOBJ structure somewhat like XPs. - Make the eboXxx members of the DC real EBRUSHOBJs and initialize them on DC creation. Except for IntArc they are not yet used and there still with the old way of doing it. - Implement DC_vUpdateXxxBrush functions that update the DCs EBRUSHOBJs after changes to the dcattr. - Implement EBRUSHOBJ_bRealizeBrush that realizes the brush by either calling the DrvRealizeBrush or EngRealizeBrush, which is currently only stubbed and this functionality is not plugged in due to other broken features. - EBRUSHOBJ_vInit: Store the RGB color and return it in BRUSHOBJ_ulGetBrushColor. - Implement EBRUSHOBJ_vSetSolidBrushColor, EBRUSHOBJ_vUpdate and EBRUSHOBJ_vUnrealizeBrush - Rename PENOBJ_bla to PEN_bla. - Make GDIOBJ_ShareUnlockObjByPtr an inline function - Implement GDIOBJ_IncrementShareCount as inline function. - NtGdiSelectBitmap: keep a shared reference on the selected bitmap. - EngAssociateSurface: don't ASSERT, but fail if locking the surface handle failed. - EngModifySurface: use an exclusive lock and handle everything inside this function.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Mar 23 01:39:00 CET 2009


Author: tkreuzer
Date: Mon Mar 23 03:38:59 2009
New Revision: 40179

URL: http://svn.reactos.org/svn/reactos?rev=40179&view=rev
Log:
Brush rewrite part 1/x
- Make the EBRUSHOBJ structure somewhat like XPs. 
- Make the eboXxx members of the DC real EBRUSHOBJs and initialize them on DC creation. Except for IntArc they are not yet used and there still with the old way of doing it.
- Implement DC_vUpdateXxxBrush functions that update the DCs EBRUSHOBJs after changes to the dcattr.
- Implement EBRUSHOBJ_bRealizeBrush that realizes the brush by either calling the DrvRealizeBrush or EngRealizeBrush, which is currently only stubbed and this functionality is not plugged in due to other broken features.
- EBRUSHOBJ_vInit: Store the RGB color and return it in BRUSHOBJ_ulGetBrushColor.
- Implement EBRUSHOBJ_vSetSolidBrushColor, EBRUSHOBJ_vUpdate and EBRUSHOBJ_vUnrealizeBrush
- Rename PENOBJ_bla to PEN_bla.
- Make GDIOBJ_ShareUnlockObjByPtr an inline function
- Implement GDIOBJ_IncrementShareCount as inline function.
- NtGdiSelectBitmap: keep a shared reference on the selected bitmap.
- EngAssociateSurface: don't ASSERT, but fail if locking the surface handle failed.
- EngModifySurface: use an exclusive lock and handle everything inside this function.

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/bitblt.c
    trunk/reactos/subsystems/win32/win32k/eng/engbrush.c
    trunk/reactos/subsystems/win32/win32k/eng/lineto.c
    trunk/reactos/subsystems/win32/win32k/eng/surface.c
    trunk/reactos/subsystems/win32/win32k/include/brush.h
    trunk/reactos/subsystems/win32/win32k/include/dc.h
    trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
    trunk/reactos/subsystems/win32/win32k/include/pen.h
    trunk/reactos/subsystems/win32/win32k/objects/arc.c
    trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
    trunk/reactos/subsystems/win32/win32k/objects/dc.c
    trunk/reactos/subsystems/win32/win32k/objects/fillshap.c
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
    trunk/reactos/subsystems/win32/win32k/objects/line.c
    trunk/reactos/subsystems/win32/win32k/objects/pen.c
    trunk/reactos/subsystems/win32/win32k/objects/stockobj.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=40179&r1=40178&r2=40179&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] Mon Mar 23 03:38:59 2009
@@ -92,7 +92,7 @@
     BYTE *tMask, *lMask;
     static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
     /* Pattern brushes */
-    PEBRUSHOBJ GdiBrush = NULL;
+    PEBRUSHOBJ pebo = NULL;
     SURFOBJ *psoPattern = NULL;
     PSURFACE psurfPattern;
     ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
@@ -107,12 +107,12 @@
 
     if (pbo && pbo->iSolidColor == 0xFFFFFFFF)
     {
-        GdiBrush = CONTAINING_RECORD(
+        pebo = CONTAINING_RECORD(
                        pbo,
                        EBRUSHOBJ,
                        BrushObject);
 
-        psurfPattern = SURFACE_LockSurface(GdiBrush->GdiBrushObject->hbmPattern);
+        psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
         if (psurfPattern != NULL)
         {
             psoPattern = &psurfPattern->SurfObj;
@@ -145,7 +145,7 @@
                 {
                     DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
                         Dest, DestRect->left + i, DestRect->top + j,
-                        DIB_GetSource(psoPattern, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush ? GdiBrush->XlateObject : NULL));
+                        DIB_GetSource(psoPattern, (DestRect->left + i) % PatternWidth, PatternY, pebo ? pebo->XlateObject : NULL));
                 }
             }
             c8++;
@@ -220,7 +220,7 @@
     if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
     {
         GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
-        if ((psurfPattern = SURFACE_LockSurface(GdiBrush->GdiBrushObject->hbmPattern)))
+        if ((psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern)))
         {
             BltInfo.PatternSurface = &psurfPattern->SurfObj;
         }
@@ -763,7 +763,7 @@
     if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
     {
         GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
-        psurfPattern = SURFACE_LockSurface(GdiBrush->GdiBrushObject->hbmPattern);
+        psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern);
         if (psurfPattern)
         {
             PatternSurface = &psurfPattern->SurfObj;

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=40179&r1=40178&r2=40179&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] Mon Mar 23 03:38:59 2009
@@ -4,8 +4,7 @@
  * PURPOSE:           GDI Driver Brush Functions
  * FILE:              subsystem/win32/win32k/eng/engbrush.c
  * PROGRAMER:         Jason Filby
- * REVISION HISTORY:
- *                 3/7/1999: Created
+ *                    Timo Kreuzer
  */
 
 #include <w32k.h>
@@ -15,9 +14,29 @@
 
 /** Internal functions ********************************************************/
 
-VOID FASTCALL
+/**
+ * This function is not exported, because it makes no sense for
+ * The driver to punt back to this function */
+BOOL
+APIENTRY
+EngRealizeBrush(
+    BRUSHOBJ *pbo,
+    SURFOBJ  *psoDst,
+    SURFOBJ  *psoPattern,
+    SURFOBJ  *psoMask,
+    XLATEOBJ *pxlo,
+    ULONG    iHatch)
+{
+    UNIMPLEMENTED;
+    return FALSE;
+}
+
+VOID
+FASTCALL
 EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo)
 {
+    ULONG iSolidColor;
+
     ASSERT(pebo);
     ASSERT(pbrush);
 
@@ -27,19 +46,108 @@
     }
     else if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
     {
-        pebo->BrushObject.iSolidColor = XLATEOBJ_iXlate(pxlo, pbrush->BrushAttr.lbColor);
+        /* Set the RGB color */
+        pebo->crRealize = pbrush->BrushAttr.lbColor;
+        pebo->ulRGBColor = pbrush->BrushAttr.lbColor;
+
+        /* Translate the brush color to the target format */
+        iSolidColor = XLATEOBJ_iXlate(pxlo, pbrush->BrushAttr.lbColor);
+        pebo->BrushObject.iSolidColor = iSolidColor;
     }
     else
     {
+        /* This is a pattern brush that needs realization */
         pebo->BrushObject.iSolidColor = 0xFFFFFFFF;
-        // FIXME: What about calling DrvRealizeBrush?
+//        EBRUSHOBJ_bRealizeBrush(pebo);
     }
 
     pebo->BrushObject.pvRbrush = pbrush->ulRealization;
     pebo->BrushObject.flColorType = 0;
-    pebo->GdiBrushObject = pbrush;
+    pebo->pbrush = pbrush;
     pebo->XlateObject = pxlo;
 }
+
+VOID
+FASTCALL
+EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, ULONG iSolidColor)
+{
+    /* Never use with non-solid brushes */
+    ASSERT(pebo->flattrs & GDIBRUSH_IS_SOLID);
+
+    pebo->BrushObject.iSolidColor = iSolidColor;
+}
+
+BOOL
+FASTCALL
+EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo)
+{
+    BOOL bResult;
+    PFN_DrvRealizeBrush pfnRealzizeBrush;
+    PSURFACE psurfTrg, psurfPattern, psurfMask;
+    PPDEVOBJ ppdev;
+    XLATEOBJ *pxlo;
+
+    psurfTrg = pebo->psurfTrg; // FIXME: all EBRUSHOBJs need a surface
+    ppdev = (PPDEVOBJ)psurfTrg->SurfObj.hdev; // FIXME: all SURFACEs need a PDEV
+
+    pfnRealzizeBrush = ppdev->DriverFunctions.RealizeBrush;
+    if (!pfnRealzizeBrush)
+    {
+        pfnRealzizeBrush = EngRealizeBrush;
+    }
+
+    psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
+
+    /* FIXME: implement mask */
+    psurfMask = NULL;
+
+    // FIXME
+    pxlo = NULL;
+
+    bResult = pfnRealzizeBrush(&pebo->BrushObject, 
+                               &pebo->psurfTrg->SurfObj,
+                               psurfPattern ? &psurfPattern->SurfObj : NULL,
+                               psurfMask ? &psurfMask->SurfObj : NULL,
+                               pxlo,
+                               -1); // FIXME: what about hatch brushes?
+
+    if (psurfPattern)
+        SURFACE_UnlockSurface(psurfPattern);
+
+    if (psurfMask)
+        SURFACE_UnlockSurface(psurfMask);
+
+    return bResult;
+}
+
+VOID
+FASTCALL
+EBRUSHOBJ_vUnrealizeBrush(EBRUSHOBJ *pebo)
+{
+    /* Check if it's a GDI realisation */
+    if (pebo->pengbrush)
+    {
+        
+    }
+    else 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);
+}
+
 
 
 /** Exported DDI functions ****************************************************/
@@ -48,30 +156,34 @@
  * @implemented
  */
 PVOID APIENTRY
-BRUSHOBJ_pvAllocRbrush(IN BRUSHOBJ  *BrushObj,
-		       IN ULONG  ObjSize)
+BRUSHOBJ_pvAllocRbrush(
+    IN BRUSHOBJ *pbo,
+    IN ULONG cj)
 {
-  BrushObj->pvRbrush=EngAllocMem(0, ObjSize, 0);
-  return(BrushObj->pvRbrush);
+    pbo->pvRbrush = EngAllocMem(0, cj, 'rbdG');
+    return pbo->pvRbrush;
 }
 
 /*
  * @implemented
  */
 PVOID APIENTRY
-BRUSHOBJ_pvGetRbrush(IN BRUSHOBJ  *BrushObj)
+BRUSHOBJ_pvGetRbrush(
+    IN BRUSHOBJ *pbo)
 {
     // FIXME: this is wrong! Read msdn.
-  return(BrushObj->pvRbrush);
+    return pbo->pvRbrush;
 }
 
 /*
  * @implemented
  */
 ULONG APIENTRY
-BRUSHOBJ_ulGetBrushColor(IN BRUSHOBJ *BrushObj)
+BRUSHOBJ_ulGetBrushColor(
+    IN BRUSHOBJ *pbo)
 {
-   return BrushObj->iSolidColor;
+    EBRUSHOBJ *pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
+    return pebo->ulRGBColor;
 }
 
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/eng/lineto.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/lineto.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/lineto.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/lineto.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -530,9 +530,9 @@
                    EBRUSHOBJ,
                    BrushObject);
     ASSERT(GdiBrush);
-    ASSERT(GdiBrush->GdiBrushObject);
-
-    if (GdiBrush->GdiBrushObject->flAttrs & GDIBRUSH_IS_NULL)
+    ASSERT(GdiBrush->pbrush);
+
+    if (GdiBrush->pbrush->flAttrs & GDIBRUSH_IS_NULL)
         return TRUE;
 
     /* No success yet */

Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/surface.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/surface.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/surface.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -506,27 +506,33 @@
 /*
  * @implemented
  */
-BOOL APIENTRY
-EngAssociateSurface(IN HSURF hsurf,
-                    IN HDEV hdev,
-                    IN ULONG Hooks)
+BOOL
+APIENTRY
+EngAssociateSurface(
+    IN HSURF hsurf,
+    IN HDEV hdev,
+    IN FLONG flHooks)
 {
     SURFOBJ *pso;
     PSURFACE psurf;
-    PDEVOBJ* Device;
-
-    Device = (PDEVOBJ*)hdev;
-
+    PDEVOBJ* ppdev;
+
+    ppdev = (PDEVOBJ*)hdev;
+
+    /* Lock the surface */
     psurf = SURFACE_LockSurface(hsurf);
-    ASSERT(psurf);
+    if (!psurf)
+    {
+        return FALSE;
+    }
     pso = &psurf->SurfObj;
 
     /* Associate the hdev */
     pso->hdev = hdev;
-    pso->dhpdev = Device->hPDev;
+    pso->dhpdev = ppdev->hPDev;
 
     /* Hook up specified functions */
-    psurf->flHooks = Hooks;
+    psurf->flHooks = flHooks;
 
     SURFACE_UnlockSurface(psurf);
 
@@ -548,25 +554,29 @@
     IN VOID *pvReserved)
 {
     SURFOBJ *pso;
-
-    pso = EngLockSurface(hsurf);
-    if (pso == NULL)
+    PSURFACE psurf;
+    PDEVOBJ* ppdev;
+
+    psurf = SURFACE_LockSurface(hsurf);
+    if (psurf == NULL)
     {
         return FALSE;
     }
 
-    if (!EngAssociateSurface(hsurf, hdev, flHooks))
-    {
-        EngUnlockSurface(pso);
-
-        return FALSE;
-    }
-
+    ppdev = (PDEVOBJ*)hdev;
+    pso = &psurf->SurfObj;
     pso->dhsurf = dhsurf;
     pso->lDelta = lDelta;
     pso->pvScan0 = pvScan0;
 
-    EngUnlockSurface(pso);
+    /* Associate the hdev */
+    pso->hdev = hdev;
+    pso->dhpdev = ppdev->hPDev;
+
+    /* Hook up specified functions */
+    psurf->flHooks = flHooks;
+
+    SURFACE_UnlockSurface(psurf);
 
     return TRUE;
 }

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=40179&r1=40178&r2=40179&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] Mon Mar 23 03:38:59 2009
@@ -15,7 +15,7 @@
  * A MAILING LIST FIRST.
  */
 
-typedef struct
+typedef struct _BRUSH
 {
   /* Header for all gdi objects in the handle table.
      Do not (re)move this. */
@@ -44,11 +44,33 @@
    ULONG Unknown6C;
 } BRUSH, *PBRUSH;
 
-typedef struct
+typedef struct _EBRUSHOBJ
 {
-   BRUSHOBJ BrushObject;
-   PBRUSH GdiBrushObject;
-   XLATEOBJ *XlateObject;
+    BRUSHOBJ    BrushObject;
+
+    COLORREF    crRealize;
+    ULONG       ulRGBColor;
+    DWORD       pengbrush;
+    ULONG       ulSurfPalTime;
+    ULONG       ulDCPalTime;
+    COLORREF    crCurrentText;
+    COLORREF    crCurrentBack;
+    COLORADJUSTMENT *pca;
+//    DWORD       dwUnknown2c;
+//    DWORD       dwUnknown30;
+    SURFACE *   psurfTrg;
+//    PALETTE *   ppalSurf;
+//    PALETTE *   ppalDC;
+//    PALETTE *   ppal3;
+//    DWORD       dwUnknown44;
+    BRUSH *     pbrush;
+    FLONG       flattrs;
+    DWORD       ulUnique;
+//    DWORD       dwUnknown54;
+//    DWORD       dwUnknown58;
+
+    /* Ros specific */
+    XLATEOBJ *XlateObject;
 } EBRUSHOBJ, *PEBRUSHOBJ;
 
 /* GDI Brush Attributes */
@@ -78,10 +100,25 @@
 #define  BRUSH_LockBrush(hBrush) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
 #define  BRUSH_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr((POBJ)pBrush)
 
+#define  BRUSH_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
+#define  BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_ShareUnlockObjByPtr((POBJ)pBrush)
+
 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);
 
+VOID
+FASTCALL
+EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, ULONG iSolidColor);
+
+VOID
+FASTCALL
+EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo);
+
+BOOL
+FASTCALL
+EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo);
+
 #endif

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=40179&r1=40178&r2=40179&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] Mon Mar 23 03:38:59 2009
@@ -190,10 +190,10 @@
   PVOID       prgnVis;
   PVOID       prgnRao;
   POINTL      ptlFillOrigin;
-  unsigned    eboFill_[23]; /* EBRUSHOBJ */
-  unsigned    eboLine_[23];
-  unsigned    eboText_[23];
-  unsigned    eboBackground_[23];
+  EBRUSHOBJ   eboFill;
+  EBRUSHOBJ   eboLine;
+  EBRUSHOBJ   eboText;
+  EBRUSHOBJ   eboBackground;
   HFONT       hlfntCur;
   FLONG       flSimulationFlags;
   LONG        lEscapement;

Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/gdiobj.h?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -61,7 +61,7 @@
 BOOL    INTERNAL_CALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner);
 BOOL    INTERNAL_CALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
 BOOL    INTERNAL_CALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
-VOID    INTERNAL_CALL GDIOBJ_ShareUnlockObjByPtr(POBJ Object);
+//VOID    INTERNAL_CALL GDIOBJ_ShareUnlockObjByPtr(POBJ Object);
 BOOL    INTERNAL_CALL GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType);
 POBJ    INTERNAL_CALL GDIOBJ_AllocObj(UCHAR ObjectType);
 POBJ    INTERNAL_CALL GDIOBJ_AllocObjWithHandle(ULONG ObjectType);
@@ -99,4 +99,22 @@
     return cLocks;
 }
 
+ULONG
+FORCEINLINE
+GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
+{
+    INT cLocks = InterlockedDecrement((PLONG)&Object->ulShareCount);
+    ASSERT(cLocks >= 0);
+    return cLocks;
+}
+
+ULONG
+FORCEINLINE
+GDIOBJ_IncrementShareCount(POBJ Object)
+{
+    INT cLocks = InterlockedIncrement((PLONG)&Object->ulShareCount);
+    ASSERT(cLocks >= 1);
+    return cLocks;
+}
+
 #endif

Modified: trunk/reactos/subsystems/win32/win32k/include/pen.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/pen.h?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/pen.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/pen.h [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -6,26 +6,30 @@
 
 /* Internal interface */
 
-#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE))
-#define PENOBJ_AllocPenWithHandle() ((PBRUSH)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PEN))
+#define PEN_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE))
+#define PEN_AllocPenWithHandle() ((PBRUSH)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PEN))
 
-#define PENOBJ_FreePen(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_BRUSH_TYPE)
-#define PENOBJ_FreePenByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
+#define PEN_FreePen(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_BRUSH_TYPE)
+#define PEN_FreePenByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
 
-//#define PENOBJ_LockPen(hBMObj) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
+//#define PEN_LockPen(hBMObj) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
 
-#define PENOBJ_AllocExtPen() ((PBRUSH)GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE))
-#define PENOBJ_AllocExtPenWithHandle() ((PBRUSH)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_EXTPEN))
+#define PEN_AllocExtPen() ((PBRUSH)GDIOBJ_AllocObj(GDIObjType_BRUSH_TYPE))
+#define PEN_AllocExtPenWithHandle() ((PBRUSH)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_EXTPEN))
 
-#define PENOBJ_FreeExtPen(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_BRUSH_TYPE)
-#define PENOBJ_FreeExtPenByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN)
+#define PEN_FreeExtPen(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_BRUSH_TYPE)
+#define PEN_FreeExtPenByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN)
 
-//#define PENOBJ_LockExtPen(hBMObj) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN))
+//#define PEN_LockExtPen(hBMObj) ((PBRUSH)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN))
 
-#define PENOBJ_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr((POBJ)pPenObj)
+#define PEN_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr((POBJ)pPenObj)
+
+#define  PEN_ShareUnlockPen(ppen) GDIOBJ_ShareUnlockObjByPtr((POBJ)ppen)
 
 
-PBRUSH FASTCALL PENOBJ_LockPen(HGDIOBJ);
+PBRUSH FASTCALL PEN_LockPen(HGDIOBJ);
+PBRUSH FASTCALL PEN_ShareLockPen(HGDIOBJ);
+
 INT APIENTRY PEN_GetObject(PBRUSH pPen, INT Count, PLOGPEN Buffer);
 
 #endif

Modified: trunk/reactos/subsystems/win32/win32k/objects/arc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/arc.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/arc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/arc.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -45,7 +45,6 @@
     PDC_ATTR pdcattr;
     RECTL RectBounds, RectSEpts;
     PBRUSH pbrushPen;
-    EBRUSHOBJ eboPen;
     SURFACE *psurf;
     BOOL ret = TRUE;
     LONG PenWidth, PenOrigWidth;
@@ -70,7 +69,7 @@
 
     pdcattr = dc->pdcattr;
 
-    pbrushPen = PENOBJ_LockPen(pdcattr->hpen);
+    pbrushPen = PEN_LockPen(pdcattr->hpen);
     if (!pbrushPen)
     {
         DPRINT1("Arc Fail 1\n");
@@ -161,24 +160,24 @@
     if (NULL == psurf)
     {
         DPRINT1("Arc Fail 2\n");
-        PENOBJ_UnlockPen(pbrushPen);
+        PEN_UnlockPen(pbrushPen);
         SetLastWin32Error(ERROR_INTERNAL_ERROR);
         return FALSE;
     }
 
-    EBRUSHOBJ_vInit(&eboPen, pbrushPen, dc->rosdc.XlatePen);
+    EBRUSHOBJ_vInit(&dc->eboLine, pbrushPen, dc->rosdc.XlatePen);
 
     if (arctype == GdiTypePie)
     {
-       PUTLINE(CenterX, CenterY, SfCx + CenterX, SfCy + CenterY, eboPen);
-       PUTLINE(EfCx + CenterX, EfCy + CenterY, CenterX, CenterY, eboPen);
+       PUTLINE(CenterX, CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine);
+       PUTLINE(EfCx + CenterX, EfCy + CenterY, CenterX, CenterY, dc->eboLine);
     }
     if (arctype == GdiTypeChord)
-        PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, eboPen);
+        PUTLINE(EfCx + CenterX, EfCy + CenterY, SfCx + CenterX, SfCy + CenterY, dc->eboLine);
            
     pbrushPen->ptPenWidth.x = PenOrigWidth;
     SURFACE_UnlockSurface(psurf);
-    PENOBJ_UnlockPen(pbrushPen);
+    PEN_UnlockPen(pbrushPen);
     DPRINT("IntArc Exit.\n");
     return ret;
 }

Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -960,11 +960,15 @@
         DC_UnlockDc(pDC);
         return NULL;
     }
+
     hOrgBmp = pDC->rosdc.hBitmap;
 
-    /* Release the old bitmap, lock the new one and convert it to a SURF */
     pDC->rosdc.hBitmap = hBmp;
 
+    /* Release the old bitmap */
+    if (pDC->dclevel.pSurface)
+        SURFACE_ShareUnlockSurface(pDC->dclevel.pSurface);
+    
     // If Info DC this is zero and pSurface is moved to DC->pSurfInfo.
     pDC->dclevel.pSurface = psurfBmp;
     psurfBmp->hDC = hDC;
@@ -985,6 +989,9 @@
                                  0,
                                  psurfBmp->SurfObj.sizlBitmap.cx,
                                  psurfBmp->SurfObj.sizlBitmap.cy);
+
+    /* Keep a shared reference on the bitmap */
+    GDIOBJ_IncrementShareCount((POBJ)psurfBmp);
     SURFACE_UnlockSurface(psurfBmp);
 
     /* Regenerate the XLATEOBJs. */
@@ -999,7 +1006,7 @@
         BRUSH_UnlockBrush(pbrush);
     }
 
-    pbrush = PENOBJ_LockPen(pdcattr->hpen);
+    pbrush = PEN_LockPen(pdcattr->hpen);
     if (pbrush)
     {
         if (pDC->rosdc.XlatePen)
@@ -1007,7 +1014,7 @@
             EngDeleteXlate(pDC->rosdc.XlatePen);
         }
         pDC->rosdc.XlatePen = IntGdiCreateBrushXlate(pDC, pbrush, &bFailed);
-        PENOBJ_UnlockPen(pbrush);
+        PEN_UnlockPen(pbrush);
     }
 
     DC_UnlockDc(pDC);

Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dc.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -2422,8 +2422,6 @@
   }
   pdcattr = NewDC->pdcattr;
 
-  NewDC->BaseObject.hHmgr = (HGDIOBJ) hDC; // Save the handle for this DC object.
-  
   xformTemplate.eM11 = 1.0f;
   xformTemplate.eM12 = 0.0f;
   xformTemplate.eM21 = 0.0f;
@@ -2461,9 +2459,18 @@
   pdcattr->crBrushClr = RGB( 255, 255, 255 );
 
 //// This fixes the default brush and pen settings. See DC_InitDC.
+
+  /* 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);
+
+  /* Create the default pen / line brush */
   pdcattr->hpen = NtGdiGetStockObject( BLACK_PEN );
-////
+  NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen);
+  EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL);
+
+
   pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
   TextIntRealizeFont(pdcattr->hlfntNew,NULL);
 
@@ -2743,7 +2750,7 @@
      {
        return FALSE;
      }
-   return SurfObj->hsurf == PrimarySurface.pSurface;
+   return SurfObj->hsurf == PrimarySurface.pSurface; // <- FIXME: WTF?
 }
 
 //
@@ -3466,4 +3473,157 @@
     return FALSE;
 }
 
+VOID
+FASTCALL
+DC_vUpdateFillBrush(PDC pdc)
+{
+    PDC_ATTR pdcattr = pdc->pdcattr;
+    PBRUSH pbrFill;
+    XLATEOBJ *pxlo;
+    ULONG iSolidColor;
+
+    /* Check if update of eboFill is needed */
+    if (pdcattr->ulDirty_ & DIRTY_FILL)
+    {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlatePen;
+
+        /* Check if the brush handle has changed */
+        if (pdcattr->hbrush != pdc->dclevel.pbrFill->BaseObject.hHmgr)
+        {
+            /* Try to lock the new brush */
+            pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
+            if (pbrFill)
+            {
+                /* Unlock old brush, set new brush */
+                BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill);
+                pdc->dclevel.pbrFill = pbrFill;
+
+                /* Update eboFill, realizing it, if needed */
+                EBRUSHOBJ_vUpdate(&pdc->eboFill, pbrFill, pxlo);
+            }
+            else
+            {
+                /* Invalid brush handle, restore old one */
+                pdcattr->hbrush = pdc->dclevel.pbrFill->BaseObject.hHmgr;
+            }
+        }
+
+        /* Check for DC brush */
+        if (pdcattr->hbrush == StockObjects[DC_BRUSH])
+        {
+            /* Translate the color to the target format */
+            iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crPenClr);
+
+            /* Update the eboFill's solid color */
+            EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboFill, iSolidColor);
+        }
+
+        /* Clear flag */
+        pdcattr->ulDirty_ &= ~DIRTY_FILL;
+    }
+}
+
+VOID
+FASTCALL
+DC_vUpdateLineBrush(PDC pdc)
+{
+    PDC_ATTR pdcattr = pdc->pdcattr;
+    PBRUSH pbrLine;
+    XLATEOBJ *pxlo;
+    ULONG iSolidColor;
+
+    /* Check if update of eboLine is needed */
+    if (pdcattr->ulDirty_ & DIRTY_LINE)
+    {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlatePen;
+
+        /* Check if the pen handle has changed */
+        if (pdcattr->hpen != pdc->dclevel.pbrLine->BaseObject.hHmgr)
+        {
+            /* Try to lock the new pen */
+            pbrLine = BRUSH_ShareLockBrush(pdcattr->hpen);
+            if (pbrLine)
+            {
+                /* Unlock old brush, set new brush */
+                BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine);
+                pdc->dclevel.pbrLine = pbrLine;
+
+                /* Update eboLine, realizing it, if needed */
+                EBRUSHOBJ_vUpdate(&pdc->eboLine, pbrLine, pxlo);
+            }
+            else
+            {
+                /* Invalid pen handle, restore old one */
+                pdcattr->hpen = pdc->dclevel.pbrLine->BaseObject.hHmgr;
+            }
+        }
+
+        /* Check for DC pen */
+        if (pdcattr->hpen == StockObjects[DC_PEN])
+        {
+            /* Translate the color to the target format */
+            iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crPenClr);
+
+            /* Update the eboLine's solid color */
+            EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboLine, iSolidColor);
+        }
+
+        /* Clear flag */
+        pdcattr->ulDirty_ &= ~DIRTY_LINE;
+    }
+}
+
+VOID
+FASTCALL
+DC_vUpdateTextBrush(PDC pdc)
+{
+    PDC_ATTR pdcattr = pdc->pdcattr;
+    XLATEOBJ *pxlo;
+    ULONG iSolidColor;
+
+    /* Check if update of eboText is needed */
+    if (pdcattr->ulDirty_ & DIRTY_TEXT)
+    {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlatePen;
+
+        /* Translate the color to the target format */
+        iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crForegroundClr);
+
+        /* Update the eboText's solid color */
+        EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboText, iSolidColor);
+
+        /* Clear flag */
+        pdcattr->ulDirty_ &= ~DIRTY_TEXT;
+    }
+}
+
+VOID
+FASTCALL
+DC_vUpdateBackgroundBrush(PDC pdc)
+{
+    PDC_ATTR pdcattr = pdc->pdcattr;
+    XLATEOBJ *pxlo;
+    ULONG iSolidColor;
+
+    /* Check if update of eboBackground is needed */
+    if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
+    {
+        /* ROS HACK, should use surf xlate */
+        pxlo = pdc->rosdc.XlatePen;
+
+        /* Translate the color to the target format */
+        iSolidColor = XLATEOBJ_iXlate(pxlo, pdcattr->crBackgroundClr);
+
+        /* Update the eboBackground's solid color */
+        EBRUSHOBJ_vSetSolidBrushColor(&pdc->eboBackground, iSolidColor);
+
+        /* Clear flag */
+        pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND;
+    }
+}
+
+
 /* EOF */

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=40179&r1=40178&r2=40179&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 Mar 23 03:38:59 2009
@@ -96,7 +96,7 @@
 
         /* Special locking order to avoid lock-ups */
         pbrushFill = BRUSH_LockBrush(pdcattr->hbrush);
-        pbrushLine = PENOBJ_LockPen(pdcattr->hpen);
+        pbrushLine = PEN_LockPen(pdcattr->hpen);
         psurf = SURFACE_LockSurface(dc->rosdc.hBitmap);
         /* FIXME - psurf can be NULL!!!! don't assert but handle this case gracefully! */
         ASSERT(psurf);
@@ -154,7 +154,7 @@
             }
         }
         if (pbrushLine)
-            PENOBJ_UnlockPen(pbrushLine);
+            PEN_UnlockPen(pbrushLine);
     }
     SURFACE_UnlockSurface(psurf);
 
@@ -252,7 +252,7 @@
     if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
        IntGdiSelectPen(dc,pdcattr->hpen);
 
-    pbrush = PENOBJ_LockPen(pdcattr->hpen);
+    pbrush = PEN_LockPen(pdcattr->hpen);
     if (!pbrush)
     {
         DPRINT1("Ellipse Fail 1\n");
@@ -333,7 +333,7 @@
                              pbrush);
 
     pbrush->ptPenWidth.x = PenOrigWidth;
-    PENOBJ_UnlockPen(pbrush);
+    PEN_UnlockPen(pbrush);
     DC_UnlockDc(dc);
     DPRINT("Ellipse Exit.\n");
     return ret;
@@ -580,7 +580,7 @@
 
     /* Special locking order to avoid lock-ups! */
     pbrushFill = BRUSH_LockBrush(pdcattr->hbrush);
-    pbrushLine = PENOBJ_LockPen(pdcattr->hpen);
+    pbrushLine = PEN_LockPen(pdcattr->hpen);
     if (!pbrushLine)
     {
         ret = FALSE;
@@ -658,7 +658,7 @@
         BRUSH_UnlockBrush(pbrushFill);
 
     if (pbrushLine)
-        PENOBJ_UnlockPen(pbrushLine);
+        PEN_UnlockPen(pbrushLine);
 
     if (psurf)
         SURFACE_UnlockSurface(psurf);
@@ -746,7 +746,7 @@
     if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
        IntGdiSelectPen(dc,pdcattr->hpen);
 
-    pbrushLine = PENOBJ_LockPen(pdcattr->hpen);
+    pbrushLine = PEN_LockPen(pdcattr->hpen);
     if (!pbrushLine)
     {
         /* Nothing to do, as we don't have a bitmap */
@@ -816,7 +816,7 @@
                    pbrushLine);
 
     pbrushLine->ptPenWidth.x = PenOrigWidth;
-    PENOBJ_UnlockPen(pbrushLine);
+    PEN_UnlockPen(pbrushLine);
     return ret;
 }
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -1013,16 +1013,6 @@
     return Object;
 }
 
-
-VOID INTERNAL_CALL
-GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
-{
-    if (InterlockedDecrement((PLONG)&Object->ulShareCount) < 0)
-    {
-        DPRINT1("Trying to unlock non-existant object\n");
-    }
-}
-
 BOOL INTERNAL_CALL
 GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle)
 {

Modified: trunk/reactos/subsystems/win32/win32k/objects/line.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/line.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/line.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -144,11 +144,11 @@
         Bounds.bottom = max(Points[0].y, Points[1].y);
 
         /* get BRUSH from current pen. */
-        pbrushLine = PENOBJ_LockPen( pdcattr->hpen );
+        pbrushLine = PEN_LockPen( pdcattr->hpen );
         if (!pbrushLine)
         {
             /* default to BLACK_PEN */
-            pbrushLine = PENOBJ_LockPen(NtGdiGetStockObject(BLACK_PEN));
+            pbrushLine = PEN_LockPen(NtGdiGetStockObject(BLACK_PEN));
             ASSERT(pbrushLine);
         }
 
@@ -165,7 +165,7 @@
         }
 
         SURFACE_UnlockSurface(psurf);
-        PENOBJ_UnlockPen( pbrushLine );
+        PEN_UnlockPen( pbrushLine );
     }
 
     if (Ret)
@@ -268,7 +268,7 @@
        IntGdiSelectPen(dc,pdcattr->hpen);
 
     /* Get BRUSHOBJ from current pen. */
-    pbrushLine = PENOBJ_LockPen(pdcattr->hpen);
+    pbrushLine = PEN_LockPen(pdcattr->hpen);
     /* FIXME - pbrushLine can be NULL! Don't assert here! */
     ASSERT(pbrushLine);
 
@@ -309,7 +309,7 @@
         }
     }
 
-    PENOBJ_UnlockPen(pbrushLine);
+    PEN_UnlockPen(pbrushLine);
 
     return Ret;
 }

Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/pen.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -29,12 +29,22 @@
 
 PBRUSH
 FASTCALL
-PENOBJ_LockPen(HGDIOBJ hBMObj)
+PEN_LockPen(HGDIOBJ hBMObj)
 {
    if (GDI_HANDLE_GET_TYPE(hBMObj) == GDI_OBJECT_TYPE_EXTPEN)
       return GDIOBJ_LockObj( hBMObj, GDI_OBJECT_TYPE_EXTPEN);
    else
       return GDIOBJ_LockObj( hBMObj, GDI_OBJECT_TYPE_PEN);
+}
+
+PBRUSH
+FASTCALL
+PEN_ShareLockPen(HGDIOBJ hBMObj)
+{
+   if (GDI_HANDLE_GET_TYPE(hBMObj) == GDI_OBJECT_TYPE_EXTPEN)
+      return GDIOBJ_ShareLockObj( hBMObj, GDI_OBJECT_TYPE_EXTPEN);
+   else
+      return GDIOBJ_ShareLockObj( hBMObj, GDI_OBJECT_TYPE_PEN);
 }
 
 HPEN APIENTRY
@@ -68,11 +78,11 @@
 
    if (bOldStylePen)
    {
-      pbrushPen = PENOBJ_AllocPenWithHandle();
+      pbrushPen = PEN_AllocPenWithHandle();
    }
    else
    {
-      pbrushPen = PENOBJ_AllocExtPenWithHandle();
+      pbrushPen = PEN_AllocExtPenWithHandle();
    }
 
    if (!pbrushPen)
@@ -173,17 +183,17 @@
       default:
          DPRINT1("IntGdiExtCreatePen unknown penstyle %x\n", dwPenStyle);
    }
-   PENOBJ_UnlockPen(pbrushPen);
+   PEN_UnlockPen(pbrushPen);
    return hPen;
 
 ExitCleanup:
    SetLastWin32Error(ERROR_INVALID_PARAMETER);
    pbrushPen->pStyle = NULL;
-   PENOBJ_UnlockPen(pbrushPen);
+   PEN_UnlockPen(pbrushPen);
    if (bOldStylePen)
-      PENOBJ_FreePenByHandle(hPen);
+      PEN_FreePenByHandle(hPen);
    else
-      PENOBJ_FreeExtPenByHandle(hPen);
+      PEN_FreeExtPenByHandle(hPen);
    return NULL;
 }
 
@@ -192,14 +202,14 @@
 {
   PBRUSH pbrushPen;
 
-  pbrushPen = PENOBJ_LockPen(hPen);
+  pbrushPen = PEN_LockPen(hPen);
   if (pbrushPen)
   {
     if (pbrushPen->flAttrs & GDIBRUSH_IS_SOLID)
     {
       pbrushPen->BrushAttr.lbColor = Color & 0xFFFFFF;
     }
-    PENOBJ_UnlockPen(pbrushPen);
+    PEN_UnlockPen(pbrushPen);
   }
 }
 
@@ -282,14 +292,14 @@
 
     pdcattr = pDC->pdcattr;
 
-    pbrushPen = PENOBJ_LockPen(hPen);
+    pbrushPen = PEN_LockPen(hPen);
     if (pbrushPen == NULL)
     {
         return NULL;
     }
 
     XlateObj = IntGdiCreateBrushXlate(pDC, pbrushPen, &bFailed);
-    PENOBJ_UnlockPen(pbrushPen);
+    PEN_UnlockPen(pbrushPen);
     if (bFailed)
     {
         SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);

Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/stockobj.c?rev=40179&r1=40178&r2=40179&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Mon Mar 23 03:38:59 2009
@@ -118,7 +118,7 @@
                    ULONG ulColor)
 {
   HPEN hPen;
-  PBRUSH pbrushPen = PENOBJ_AllocPenWithHandle();
+  PBRUSH pbrushPen = PEN_AllocPenWithHandle();
 
   if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1;
    
@@ -143,7 +143,7 @@
         break;
   }
   hPen = pbrushPen->BaseObject.hHmgr;
-  PENOBJ_UnlockPen(pbrushPen);
+  PEN_UnlockPen(pbrushPen);
   return hPen;    
 }
 



More information about the Ros-diffs mailing list