[ros-diffs] [tkreuzer] 41892: [win32k] Implement brush realization part 2 / 2 Use EBRUSHOBJ_pvGetEngBrush to get a handle to the realized (color translated) brush and use this instead of the original pattern when doing patblts. We don't use any XLATEOBJ anymore. I'll leave it to the interested reader to cleanup the DIB code from remnants of pattern to dest color translation.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Jul 11 22:15:38 CEST 2009


Author: tkreuzer
Date: Sun Jul 12 00:15:37 2009
New Revision: 41892

URL: http://svn.reactos.org/svn/reactos?rev=41892&view=rev
Log:
[win32k] Implement brush realization part 2 / 2
Use EBRUSHOBJ_pvGetEngBrush to get a handle to the realized (color translated) brush and use this instead of the original pattern when doing patblts. We don't use any XLATEOBJ anymore. I'll leave it to the interested reader to cleanup the DIB code from remnants of pattern to dest color translation.

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/include/brush.h

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=41892&r1=41891&r2=41892&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] Sun Jul 12 00:15:37 2009
@@ -48,9 +48,8 @@
     LONG PatternX0 = 0, PatternX = 0, PatternY = 0;
     PFN_DIB_PutPixel fnDest_PutPixel = NULL;
     PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
-    XLATEOBJ *XlateObj;
     ULONG Pattern = 0;
-    SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
+    HBITMAP hbmPattern;
 
     if (psoMask == NULL)
     {
@@ -61,7 +60,8 @@
     {
         pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
 
-        psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
+        hbmPattern = EBRUSHOBJ_pvGetEngBrush(pebo);
+        psurfPattern = SURFACE_LockSurface(hbmPattern);
         if (psurfPattern != NULL)
         {
             psoPattern = &psurfPattern->SurfObj;
@@ -79,9 +79,6 @@
     fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
     if (psurfPattern)
     {
-        XlateObj = IntCreateBrushXlate(pebo->pbrush,
-                                       psurfDest,
-                                       pebo->crCurrentBack);
         PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
         if (PatternY < 0)
         {
@@ -104,8 +101,7 @@
                 if (*pjMskCurrent & fjMaskBit)
                 {
                     fnDest_PutPixel(psoDest, x, y,
-                        XLATEOBJ_iXlate(XlateObj,
-                            fnPattern_GetPixel(psoPattern, PatternX, PatternY)));
+                        fnPattern_GetPixel(psoPattern, PatternX, PatternY));
                 }
                 fjMaskBit = _rotr8(fjMaskBit, 1);
                 pjMskCurrent += (fjMaskBit >> 7);
@@ -116,9 +112,6 @@
             PatternY++;
             PatternY %= PatternHeight;
         }
-
-        if (XlateObj)
-            EngDeleteXlate(XlateObj);
     }
     else
     {
@@ -183,8 +176,7 @@
     PEBRUSHOBJ GdiBrush = NULL;
     SURFACE *psurfPattern;
     BOOLEAN Result;
-    SURFACE *psurfDest = CONTAINING_RECORD(OutputObj, SURFACE, SurfObj);
-    XLATEOBJ *XlatePatternToDest = NULL;
+    HBITMAP hbmPattern;
 
     BltInfo.DestSurface = OutputObj;
     BltInfo.SourceSurface = InputObj;
@@ -205,7 +197,9 @@
     if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
     {
         GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
-        if ((psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern)))
+        hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
+        psurfPattern = SURFACE_LockSurface(hbmPattern);
+        if (psurfPattern)
         {
             BltInfo.PatternSurface = &psurfPattern->SurfObj;
         }
@@ -213,10 +207,6 @@
         {
             /* FIXME - What to do here? */
         }
-        XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
-                                                 psurfDest,
-                                                 GdiBrush->crCurrentBack);
-        BltInfo.XlatePatternToDest = XlatePatternToDest;
     }
     else
     {
@@ -225,11 +215,8 @@
 
     Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
 
-    if (XlatePatternToDest)
-        EngDeleteXlate(XlatePatternToDest);
-
     /* Pattern brush */
-    if (psurfPattern != NULL)
+    if (psurfPattern)
     {
         SURFACE_UnlockSurface(psurfPattern);
     }

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=41892&r1=41891&r2=41892&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] Sun Jul 12 00:15:37 2009
@@ -276,8 +276,10 @@
         if (!bResult)
         {
             if (pbo->pvRbrush)
+            {
                 EngFreeMem(pbo->pvRbrush);
-            pbo->pvRbrush = NULL;
+                pbo->pvRbrush = NULL;
+            }
         }
     }
 

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=41892&r1=41891&r2=41892&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] Sun Jul 12 00:15:37 2009
@@ -38,9 +38,8 @@
     SURFACE* psurfPattern;
     PEBRUSHOBJ GdiBrush = NULL;
     SURFOBJ* PatternSurface = NULL;
-    XLATEOBJ* XlatePatternToDest = NULL;
     BOOL bResult;
-    SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
+    HBITMAP hbmPattern;
 
     if (BrushOrigin == NULL)
     {
@@ -55,7 +54,8 @@
     if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
     {
         GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
-        psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern);
+        hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
+        psurfPattern = SURFACE_LockSurface(hbmPattern);
         if (psurfPattern)
         {
             PatternSurface = &psurfPattern->SurfObj;
@@ -64,9 +64,6 @@
         {
             /* FIXME - What to do here? */
         }
-        XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
-                                                 psurfDest,
-                                                 GdiBrush->crCurrentBack);
     }
     else
     {
@@ -76,12 +73,7 @@
     bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
                psoDest, psoSource, Mask, PatternSurface,
                OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
-               ColorTranslation, XlatePatternToDest, Rop4);
-
-    if (XlatePatternToDest)
-    {
-        EngDeleteXlate(XlatePatternToDest);
-    }
+               ColorTranslation, NULL, Rop4);
 
     /* Pattern brush */
     if (psurfPattern)
@@ -155,7 +147,7 @@
         /* Copy destination onto itself: nop */
         return TRUE;
     }
-   
+
     OutputRect = *prclDest;
     if (OutputRect.right < OutputRect.left)
     {
@@ -167,7 +159,7 @@
         OutputRect.top = prclDest->bottom;
         OutputRect.bottom = prclDest->top;
     }
-    
+
     InputRect = *prclSrc;
     if (UsesSource)
     {
@@ -256,12 +248,12 @@
     switch (clippingType)
     {
         case DC_TRIVIAL:
-            Ret = (*BltRectFunc)(psoOutput, psoInput, Mask, 
+            Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
                          ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
                          pbo, &AdjustedBrushOrigin, ROP4);
             break;
         case DC_RECT:
-            // Clip the blt to the clip rectangle 
+            // Clip the blt to the clip rectangle
             ClipRect.left = ClipRegion->rclBounds.left + Translate.x;
             ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
             ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
@@ -272,13 +264,13 @@
                 InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
                 InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
                 InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
-                Ret = (*BltRectFunc)(psoOutput, psoInput, Mask, 
-                           ColorTranslation, 
+                Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
+                           ColorTranslation,
                            &CombinedRect,
                            &InputToCombinedRect,
                            MaskOrigin,
-                           pbo, 
-                           &AdjustedBrushOrigin, 
+                           pbo,
+                           &AdjustedBrushOrigin,
                            ROP4);
             }
             break;
@@ -317,13 +309,13 @@
                         InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
                         InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
                         InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
-                        Ret = (*BltRectFunc)(psoOutput, psoInput, Mask, 
-                           ColorTranslation, 
+                        Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
+                           ColorTranslation,
                            &CombinedRect,
                            &InputToCombinedRect,
                            MaskOrigin,
-                           pbo, 
-                           &AdjustedBrushOrigin, 
+                           pbo,
+                           &AdjustedBrushOrigin,
                            ROP4);
                     }
                 }
@@ -415,7 +407,7 @@
         InputClippedRect.top = DestRect->bottom;
         InputClippedRect.bottom = DestRect->top;
     }
-    
+
     if (UsesSource)
     {
         if (NULL == SourceRect || NULL == psoSource)
@@ -423,14 +415,14 @@
             return FALSE;
         }
         InputRect = *SourceRect;
- 
+
         if (InputRect.right < InputRect.left ||
                 InputRect.bottom < InputRect.top)
         {
             /* Everything clipped away, nothing to do */
             return TRUE;
         }
-    }    
+    }
 
     if (ClipRegion)
     {
@@ -454,7 +446,7 @@
     {
         OutputRect = InputClippedRect;
     }
-    
+
     if (pMaskOrigin != NULL)
     {
         MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;

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=41892&r1=41891&r2=41892&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] Sun Jul 12 00:15:37 2009
@@ -124,4 +124,8 @@
 NTAPI
 EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
 
+PVOID
+NTAPI
+EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
+
 #endif



More information about the Ros-diffs mailing list