[YAROTOWS] Reintegrate the branch. For a brighter future.
[reactos.git] / reactos / subsystems / win32 / win32k / eng / alphablend.c
index 34b2930..afd1b5e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
  * PURPOSE:          GDI alpha blending functions
@@ -25,10 +25,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
               IN PRECTL SourceRect,
               IN BLENDOBJ *BlendObj)
 {
-    RECTL              SourceStretchedRect;
-    SIZEL              SourceStretchedSize;
-    HBITMAP            SourceStretchedBitmap = 0;
-    SURFOBJ*           SourceStretchedObj = NULL;
     RECTL              InputRect;
     RECTL              OutputRect;
     RECTL              ClipRect;
@@ -39,7 +35,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
     INTENG_ENTER_LEAVE EnterLeaveDest;
     SURFOBJ*           InputObj;
     SURFOBJ*           OutputObj;
-    LONG               Width;
     LONG               ClippingType;
     RECT_ENUM          RectEnum;
     BOOL               EnumMore;
@@ -71,7 +66,7 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
     InputRect = *SourceRect;
     if ( (InputRect.top < 0) || (InputRect.bottom < 0) ||
          (InputRect.left < 0) || (InputRect.right < 0) ||
-         InputRect.right > psoSource->sizlBitmap.cx || 
+         InputRect.right > psoSource->sizlBitmap.cx ||
          InputRect.bottom > psoSource->sizlBitmap.cy )
     {
         SetLastWin32Error(ERROR_INVALID_PARAMETER);
@@ -111,68 +106,9 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
         return TRUE;
     }
 
-    /* Stretch source if needed */
-    if (OutputRect.right - OutputRect.left != InputRect.right - InputRect.left ||
-            OutputRect.bottom - OutputRect.top != InputRect.bottom - InputRect.top)
-    {
-        SourceStretchedSize.cx = OutputRect.right - OutputRect.left;
-        SourceStretchedSize.cy = OutputRect.bottom - OutputRect.top;
-        Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(psoSource->iBitmapFormat));
-        /* FIXME: Maybe it is a good idea to use EngCreateDeviceBitmap and IntEngStretchBlt
-                  if possible to get a HW accelerated stretch. */
-        SourceStretchedBitmap = EngCreateBitmap(SourceStretchedSize, Width, psoSource->iBitmapFormat,
-                                                BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
-        if (SourceStretchedBitmap == 0)
-        {
-            DPRINT1("EngCreateBitmap failed!\n");
-            return FALSE;
-        }
-        SourceStretchedObj = EngLockSurface((HSURF)SourceStretchedBitmap);
-        if (SourceStretchedObj == NULL)
-        {
-            DPRINT1("EngLockSurface failed!\n");
-            EngDeleteSurface((HSURF)SourceStretchedBitmap);
-            return FALSE;
-        }
-
-        SourceStretchedRect.left = 0;
-        SourceStretchedRect.right = SourceStretchedSize.cx;
-        SourceStretchedRect.top = 0;
-        SourceStretchedRect.bottom = SourceStretchedSize.cy;
-        /* FIXME: IntEngStretchBlt isn't used here atm because it results in a
-                  try to acquire an already acquired mutex (lock the already locked source surface) */
-        /*if (!IntEngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL,
-                              NULL, &SourceStretchedRect, SourceRect, NULL,
-                              NULL, NULL, COLORONCOLOR))*/
-        if (!EngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL, NULL,
-                           NULL, NULL, &SourceStretchedRect, &InputRect,
-                           NULL, COLORONCOLOR))
-        {
-            DPRINT1("EngStretchBlt failed!\n");
-            EngFreeMem(SourceStretchedObj->pvBits);
-            EngUnlockSurface(SourceStretchedObj);
-            EngDeleteSurface((HSURF)SourceStretchedBitmap);
-            return FALSE;
-        }
-        InputRect.top = SourceStretchedRect.top;
-        InputRect.bottom = SourceStretchedRect.bottom;
-        InputRect.left = SourceStretchedRect.left;
-        InputRect.right = SourceStretchedRect.right;
-        psoSource = SourceStretchedObj;
-    }
-
     /* Now call the DIB function */
     if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
     {
-        if (SourceStretchedObj != NULL)
-        {
-            EngFreeMem(SourceStretchedObj->pvBits);
-            EngUnlockSurface(SourceStretchedObj);
-        }
-        if (SourceStretchedBitmap != 0)
-        {
-            EngDeleteSurface((HSURF)SourceStretchedBitmap);
-        }
         return FALSE;
     }
     InputRect.left +=  Translate.x;
@@ -182,16 +118,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
 
     if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
     {
-        IntEngLeave(&EnterLeaveSource);
-        if (SourceStretchedObj != NULL)
-        {
-            EngFreeMem(SourceStretchedObj->pvBits);
-            EngUnlockSurface(SourceStretchedObj);
-        }
-        if (SourceStretchedBitmap != 0)
-        {
-            EngDeleteSurface((HSURF)SourceStretchedBitmap);
-        }
         return FALSE;
     }
     OutputRect.left += Translate.x;
@@ -261,16 +187,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest,
     IntEngLeave(&EnterLeaveDest);
     IntEngLeave(&EnterLeaveSource);
 
-    if (SourceStretchedObj != NULL)
-    {
-        EngFreeMem(SourceStretchedObj->pvBits);
-        EngUnlockSurface(SourceStretchedObj);
-    }
-    if (SourceStretchedBitmap != 0)
-    {
-        EngDeleteSurface((HSURF)SourceStretchedBitmap);
-    }
-
     return Ret;
 }
 
@@ -305,17 +221,8 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
         return TRUE;
     }
 
-    SURFACE_LockBitmapBits(psurfDest);
-    MouseSafetyOnDrawStart(psoDest, DestRect->left, DestRect->top,
-                           DestRect->right, DestRect->bottom);
-
-    if (psoSource != psoDest)
-        SURFACE_LockBitmapBits(psurfSource);
-    MouseSafetyOnDrawStart(psoSource, SourceRect->left, SourceRect->top,
-                           SourceRect->right, SourceRect->bottom);
-
     /* Call the driver's DrvAlphaBlend if available */
-    if (psurfDest->flHooks & HOOK_ALPHABLEND)
+    if (psurfDest->flags & HOOK_ALPHABLEND)
     {
         ret = GDIDEVFUNCS(psoDest).AlphaBlend(
                   psoDest, psoSource, ClipRegion, ColorTranslation,
@@ -328,12 +235,6 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
                             DestRect, SourceRect, BlendObj);
     }
 
-    MouseSafetyOnDrawEnd(psoSource);
-    if (psoSource != psoDest)
-        SURFACE_UnlockBitmapBits(psurfSource);
-    MouseSafetyOnDrawEnd(psoDest);
-    SURFACE_UnlockBitmapBits(psurfDest);
-
     return ret;
 }