Sync with trunk (r48545)
[reactos.git] / subsystems / win32 / win32k / eng / bitblt.c
index fdd5149..9077df7 100644 (file)
@@ -9,7 +9,7 @@
  *        2/10/1999: Created
  */
 
-#include <w32k.h>
+#include <win32k.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -51,6 +51,9 @@ BltMask(SURFOBJ* psoDest,
     ULONG Pattern = 0;
     HBITMAP hbmPattern;
 
+    ASSERT(psoSource == NULL);
+    ASSERT(pptlSource == NULL);
+
     if (psoMask == NULL)
     {
         return FALSE;
@@ -432,11 +435,11 @@ EngBitBlt(SURFOBJ *DestObj,
         clippingType = ClipRegion->iDComplexity;
     }
 
-    if (R4_MASK == rop4)
+    /*if (R4_MASK == rop4)
     {
         BltRectFunc = BltMask;
     }
-    else if (ROP3_TO_ROP4(PATCOPY) == rop4)
+    else */if (ROP3_TO_ROP4(PATCOPY) == rop4)
     {
         if (pbo && pbo->iSolidColor == 0xFFFFFFFF)
             BltRectFunc = CallDibBitBlt;
@@ -521,7 +524,7 @@ EngBitBlt(SURFOBJ *DestObj,
 }
 
 BOOL APIENTRY
-IntEngBitBltEx(
+IntEngBitBlt(
     SURFOBJ *psoTrg,
     SURFOBJ *psoSrc,
     SURFOBJ *psoMask,
@@ -532,8 +535,7 @@ IntEngBitBltEx(
     POINTL *pptlMask,
     BRUSHOBJ *pbo,
     POINTL *pptlBrush,
-    ROP4 rop4,
-    BOOL bRemoveMouse)
+    ROP4 rop4)
 {
     SURFACE *psurfTrg;
     SURFACE *psurfSrc = NULL;
@@ -583,10 +585,10 @@ IntEngBitBltEx(
     }
 
     /* Is the target surface device managed? */
-    if (psurfTrg->flHooks & HOOK_BITBLT)
+    if (psurfTrg->flags & HOOK_BITBLT)
     {
         /* Is the source a different device managed surface? */
-        if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flHooks & HOOK_BITBLT)
+        if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flags & HOOK_BITBLT)
         {
             DPRINT1("Need to copy to standard bitmap format!\n");
             ASSERT(FALSE);
@@ -596,7 +598,7 @@ IntEngBitBltEx(
     }
 
     /* Is the source surface device managed? */
-    else if (psoSrc && psurfSrc->flHooks & HOOK_BITBLT)
+    else if (psoSrc && psurfSrc->flags & HOOK_BITBLT)
     {
         pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt;
     }
@@ -630,8 +632,8 @@ static BOOLEAN APIENTRY
 AlphaBltMask(SURFOBJ* psoDest,
              SURFOBJ* psoSource, // unused
              SURFOBJ* psoMask,
-             XLATEOBJ* ColorTranslation,
-             XLATEOBJ* SrcColorTranslation,
+             XLATEOBJ* pxloRGB2Dest,
+             XLATEOBJ* pxloBrush,
              RECTL* prclDest,
              POINTL* pptlSource, // unused
              POINTL* pptlMask,
@@ -643,12 +645,15 @@ AlphaBltMask(SURFOBJ* psoDest,
     ULONG Background, BrushColor, NewColor;
     BYTE *tMask, *lMask;
 
+    ASSERT(psoSource == NULL);
+    ASSERT(pptlSource == NULL);
+
     dx = prclDest->right  - prclDest->left;
     dy = prclDest->bottom - prclDest->top;
 
     if (psoMask != NULL)
     {
-        BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, pbo ? pbo->iSolidColor : 0);
+        BrushColor = XLATEOBJ_iXlate(pxloBrush, pbo ? pbo->iSolidColor : 0);
         r = (int)GetRValue(BrushColor);
         g = (int)GetGValue(BrushColor);
         b = (int)GetBValue(BrushColor);
@@ -669,14 +674,14 @@ AlphaBltMask(SURFOBJ* psoDest,
                     else
                     {
                         Background = DIB_GetSource(psoDest, prclDest->left + i, prclDest->top + j,
-                                                   SrcColorTranslation);
+                                                   pxloBrush);
 
                         NewColor =
                             RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background),
                                 (*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background),
                                 (*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background));
 
-                        Background = XLATEOBJ_iXlate(ColorTranslation, NewColor);
+                        Background = XLATEOBJ_iXlate(pxloRGB2Dest, NewColor);
                         DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel(
                             psoDest, prclDest->left + i, prclDest->top + j, Background);
                     }
@@ -814,10 +819,10 @@ EngMaskBitBlt(SURFOBJ *psoDest,
         case DC_TRIVIAL:
             if (psoMask->iBitmapFormat == BMF_8BPP)
                 Ret = AlphaBltMask(psoOutput, NULL , psoInput, DestColorTranslation, SourceColorTranslation,
-                                   &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin);
+                                   &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin);
             else
                 Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation,
-                              &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin,
+                              &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin,
                               R4_MASK);
             break;
         case DC_RECT:
@@ -832,13 +837,13 @@ EngMaskBitBlt(SURFOBJ *psoDest,
                 Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
                 if (psoMask->iBitmapFormat == BMF_8BPP)
                 {
-                    Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation,
-                                       &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin);
+                    Ret = AlphaBltMask(psoOutput, NULL, psoInput, DestColorTranslation, SourceColorTranslation,
+                                       &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin);
                 }
                 else
                 {
-                    Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation,
-                                  &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin, R4_MASK);
+                    Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation,
+                                  &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin, R4_MASK);
                 }
             }
             break;
@@ -876,17 +881,17 @@ EngMaskBitBlt(SURFOBJ *psoDest,
                         Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
                         if (psoMask->iBitmapFormat == BMF_8BPP)
                         {
-                            Ret = AlphaBltMask(psoOutput, psoInput, psoMask,
+                            Ret = AlphaBltMask(psoOutput, NULL, psoInput,
                                                DestColorTranslation,
                                                SourceColorTranslation,
-                                               &CombinedRect, &Pt, pptlMask, pbo,
+                                               &CombinedRect, NULL, &Pt, pbo,
                                                &AdjustedBrushOrigin) && Ret;
                         }
                         else
                         {
-                            Ret = BltMask(psoOutput, psoInput, psoMask,
-                                          DestColorTranslation, &CombinedRect, &Pt,
-                                          pptlMask, pbo, &AdjustedBrushOrigin,
+                            Ret = BltMask(psoOutput, NULL, psoInput,
+                                          DestColorTranslation, &CombinedRect, NULL,
+                                          &Pt, pbo, &AdjustedBrushOrigin,
                                           R4_MASK) && Ret;
                         }
                     }
@@ -950,17 +955,17 @@ IntEngMaskBlt(SURFOBJ *psoDest,
     /* Dummy BitBlt to let driver know that it should flush its changes.
        This should really be done using a call to DrvSynchronizeSurface,
        but the VMware driver doesn't hook that call. */
-    IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
+    IntEngBitBlt(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
                    DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
-                   R4_NOOP, FALSE);
+                   R4_NOOP);
 
     ret = EngMaskBitBlt(psoDest, psoMask, ClipRegion, DestColorTranslation, SourceColorTranslation,
                         &OutputRect, &InputPoint, pbo, BrushOrigin);
 
     /* Dummy BitBlt to let driver know that something has changed. */
-    IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
+    IntEngBitBlt(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
                    DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
-                   R4_NOOP, FALSE);
+                   R4_NOOP);
 
     return ret;
 }