[ros-diffs] [tkreuzer] 26301: tabs->spaces reformat, no code change.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Apr 9 21:52:32 CEST 2007


Author: tkreuzer
Date: Mon Apr  9 23:52:32 2007
New Revision: 26301

URL: http://svn.reactos.org/svn/reactos?rev=26301&view=rev
Log:
tabs->spaces reformat, no code change.

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/bitblt.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=26301&r1=26300&r2=26301&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/bitblt.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/bitblt.c Mon Apr  9 23:52:32 2007
@@ -55,133 +55,133 @@
 
 BOOL STDCALL EngIntersectRect(RECTL* prcDst, RECTL* prcSrc1, RECTL* prcSrc2)
 {
-  static const RECTL rclEmpty = { 0, 0, 0, 0 };
-
-  prcDst->left  = max(prcSrc1->left, prcSrc2->left);
-  prcDst->right = min(prcSrc1->right, prcSrc2->right);
-
-  if (prcDst->left < prcDst->right)
-    {
-      prcDst->top    = max(prcSrc1->top, prcSrc2->top);
-      prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
-
-      if (prcDst->top < prcDst->bottom)
-	{
-	  return TRUE;
-	}
-    }
-
-  *prcDst = rclEmpty;
-
-  return FALSE;
+    static const RECTL rclEmpty = { 0, 0, 0, 0 };
+
+    prcDst->left  = max(prcSrc1->left, prcSrc2->left);
+    prcDst->right = min(prcSrc1->right, prcSrc2->right);
+
+    if (prcDst->left < prcDst->right)
+    {
+        prcDst->top    = max(prcSrc1->top, prcSrc2->top);
+        prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
+
+        if (prcDst->top < prcDst->bottom)
+        {
+            return TRUE;
+        }
+    }
+
+    *prcDst = rclEmpty;
+
+    return FALSE;
 }
 
 static BOOLEAN STDCALL
 BltMask(SURFOBJ* Dest,
-	SURFOBJ* Source,
-	SURFOBJ* Mask,
-	XLATEOBJ* ColorTranslation,
-	RECTL* DestRect,
-	POINTL* SourcePoint,
-	POINTL* MaskPoint,
-	BRUSHOBJ* Brush,
-	POINTL* BrushPoint,
-	ROP4 Rop4)
+        SURFOBJ* Source,
+        SURFOBJ* Mask,
+        XLATEOBJ* ColorTranslation,
+        RECTL* DestRect,
+        POINTL* SourcePoint,
+        POINTL* MaskPoint,
+        BRUSHOBJ* Brush,
+        POINTL* BrushPoint,
+        ROP4 Rop4)
 {
-   LONG i, j, dx, dy, c8;
-   BYTE *tMask, *lMask;
-   static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
-   /* Pattern brushes */
-   PGDIBRUSHINST GdiBrush = NULL;
-   SURFOBJ *PatternObj = NULL;
-   PBITMAPOBJ PatternBitmap;
-   ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
-
-   if (Mask == NULL)
-   {
-      return FALSE;
-   }
-
-   dx = DestRect->right  - DestRect->left;
-   dy = DestRect->bottom - DestRect->top;
-
-   if (Brush->iSolidColor == 0xFFFFFFFF)
-   {
-      GdiBrush = CONTAINING_RECORD(
-         Brush,
-         GDIBRUSHINST,
-         BrushObject);
-
-      PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern);
-      if(PatternBitmap != NULL)
-      {
-        PatternObj = &PatternBitmap->SurfObj;
-        PatternWidth = PatternObj->sizlBitmap.cx;
-        PatternHeight = PatternObj->sizlBitmap.cy;
-      }
-   }
-   else
-     PatternBitmap = NULL;
-
-   tMask = (PBYTE)Mask->pvScan0 + SourcePoint->y * Mask->lDelta + (SourcePoint->x >> 3);
-   for (j = 0; j < dy; j++)
-   {
-      lMask = tMask;
-      c8 = SourcePoint->x & 0x07;
-
-      if(PatternBitmap != NULL)
-         PatternY = (DestRect->top + j) % PatternHeight;
-
-      for (i = 0; i < dx; i++)
-      {
-         if (0 != (*lMask & maskbit[c8]))
-         {
-            if (PatternBitmap == NULL)
+    LONG i, j, dx, dy, c8;
+    BYTE *tMask, *lMask;
+    static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
+    /* Pattern brushes */
+    PGDIBRUSHINST GdiBrush = NULL;
+    SURFOBJ *PatternObj = NULL;
+    PBITMAPOBJ PatternBitmap;
+    ULONG PatternWidth = 0, PatternHeight = 0, PatternY = 0;
+
+    if (Mask == NULL)
+    {
+        return FALSE;
+    }
+
+    dx = DestRect->right  - DestRect->left;
+    dy = DestRect->bottom - DestRect->top;
+
+    if (Brush->iSolidColor == 0xFFFFFFFF)
+    {
+        GdiBrush = CONTAINING_RECORD(
+                       Brush,
+                       GDIBRUSHINST,
+                       BrushObject);
+
+        PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern);
+        if (PatternBitmap != NULL)
+        {
+            PatternObj = &PatternBitmap->SurfObj;
+            PatternWidth = PatternObj->sizlBitmap.cx;
+            PatternHeight = PatternObj->sizlBitmap.cy;
+        }
+    }
+    else
+        PatternBitmap = NULL;
+
+    tMask = (PBYTE)Mask->pvScan0 + SourcePoint->y * Mask->lDelta + (SourcePoint->x >> 3);
+    for (j = 0; j < dy; j++)
+    {
+        lMask = tMask;
+        c8 = SourcePoint->x & 0x07;
+
+        if (PatternBitmap != NULL)
+            PatternY = (DestRect->top + j) % PatternHeight;
+
+        for (i = 0; i < dx; i++)
+        {
+            if (0 != (*lMask & maskbit[c8]))
             {
-               DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
-                  Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
+                if (PatternBitmap == NULL)
+                {
+                    DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
+                        Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
+                }
+                else
+                {
+                    DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
+                        Dest, DestRect->left + i, DestRect->top + j,
+                        DIB_GetSource(PatternObj, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush->XlateObject));
+                }
             }
-            else
+            c8++;
+            if (8 == c8)
             {
-               DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
-                  Dest, DestRect->left + i, DestRect->top + j,
-                  DIB_GetSource(PatternObj, (DestRect->left + i) % PatternWidth, PatternY, GdiBrush->XlateObject));
+                lMask++;
+                c8 = 0;
             }
-         }
-         c8++;
-         if (8 == c8)
-         {
-            lMask++;
-            c8 = 0;
-         }
-      }
-      tMask += Mask->lDelta;
-   }
-
-   if (PatternBitmap != NULL)
-      BITMAPOBJ_UnlockBitmap(PatternBitmap);
-
-   return TRUE;
+        }
+        tMask += Mask->lDelta;
+    }
+
+    if (PatternBitmap != NULL)
+        BITMAPOBJ_UnlockBitmap(PatternBitmap);
+
+    return TRUE;
 }
 
 static BOOLEAN STDCALL
 BltPatCopy(SURFOBJ* Dest,
-	   SURFOBJ* Source,
-	   SURFOBJ* Mask,
-	   XLATEOBJ* ColorTranslation,
-	   RECTL* DestRect,
-	   POINTL* SourcePoint,
-	   POINTL* MaskPoint,
-	   BRUSHOBJ* Brush,
-	   POINTL* BrushPoint,
-	   ROP4 Rop4)
+           SURFOBJ* Source,
+           SURFOBJ* Mask,
+           XLATEOBJ* ColorTranslation,
+           RECTL* DestRect,
+           POINTL* SourcePoint,
+           POINTL* MaskPoint,
+           BRUSHOBJ* Brush,
+           POINTL* BrushPoint,
+           ROP4 Rop4)
 {
-  // These functions are assigned if we're working with a DIB
-  // The assigned functions depend on the bitsPerPixel of the DIB
-
-  DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, Brush->iSolidColor);
-
-  return TRUE;
+    // These functions are assigned if we're working with a DIB
+    // The assigned functions depend on the bitsPerPixel of the DIB
+
+    DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_ColorFill(Dest, DestRect, Brush->iSolidColor);
+
+    return TRUE;
 }
 
 static BOOLEAN STDCALL
@@ -196,54 +196,54 @@
               POINTL* BrushOrigin,
               ROP4 Rop4)
 {
-   BLTINFO BltInfo;
-   PGDIBRUSHINST GdiBrush = NULL;
-   BITMAPOBJ *bmPattern;
-   BOOLEAN Result;
-
-   BltInfo.DestSurface = OutputObj;
-   BltInfo.SourceSurface = InputObj;
-   BltInfo.PatternSurface = NULL;
-   BltInfo.XlateSourceToDest = ColorTranslation;
-   BltInfo.DestRect = *OutputRect;
-   BltInfo.SourcePoint = *InputPoint;
-
-   if (ROP3_TO_ROP4(SRCCOPY) == Rop4)
-      return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
-
-   BltInfo.XlatePatternToDest = NULL;
-   BltInfo.Brush = Brush;
-   BltInfo.BrushOrigin = *BrushOrigin;
-   BltInfo.Rop4 = Rop4;
-
-   /* Pattern brush */
-   if (ROP4_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF)
-   {
-      GdiBrush = CONTAINING_RECORD(Brush, GDIBRUSHINST, BrushObject);
-      if((bmPattern = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern)))
-      {
-        BltInfo.PatternSurface = &bmPattern->SurfObj;
-      }
-      else
-      {
-        /* FIXME - What to do here? */
-      }
-      BltInfo.XlatePatternToDest = GdiBrush->XlateObject;
-   }
-   else
-   {
-     bmPattern = NULL;
-   }
-
-   Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
-
-   /* Pattern brush */
-   if (bmPattern != NULL)
-   {
-      BITMAPOBJ_UnlockBitmap(bmPattern);
-   }
-
-   return Result;
+    BLTINFO BltInfo;
+    PGDIBRUSHINST GdiBrush = NULL;
+    BITMAPOBJ *bmPattern;
+    BOOLEAN Result;
+
+    BltInfo.DestSurface = OutputObj;
+    BltInfo.SourceSurface = InputObj;
+    BltInfo.PatternSurface = NULL;
+    BltInfo.XlateSourceToDest = ColorTranslation;
+    BltInfo.DestRect = *OutputRect;
+    BltInfo.SourcePoint = *InputPoint;
+
+    if (ROP3_TO_ROP4(SRCCOPY) == Rop4)
+        return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
+
+    BltInfo.XlatePatternToDest = NULL;
+    BltInfo.Brush = Brush;
+    BltInfo.BrushOrigin = *BrushOrigin;
+    BltInfo.Rop4 = Rop4;
+
+    /* Pattern brush */
+    if (ROP4_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF)
+    {
+        GdiBrush = CONTAINING_RECORD(Brush, GDIBRUSHINST, BrushObject);
+        if ((bmPattern = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern)))
+        {
+            BltInfo.PatternSurface = &bmPattern->SurfObj;
+        }
+        else
+        {
+            /* FIXME - What to do here? */
+        }
+        BltInfo.XlatePatternToDest = GdiBrush->XlateObject;
+    }
+    else
+    {
+        bmPattern = NULL;
+    }
+
+    Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
+
+    /* Pattern brush */
+    if (bmPattern != NULL)
+    {
+        BITMAPOBJ_UnlockBitmap(bmPattern);
+    }
+
+    return Result;
 }
 
 INT __cdecl abs(INT nm);
@@ -253,280 +253,280 @@
  */
 BOOL STDCALL
 EngBitBlt(SURFOBJ *DestObj,
-	  SURFOBJ *SourceObj,
-	  SURFOBJ *Mask,
-	  CLIPOBJ *ClipRegion,
-	  XLATEOBJ *ColorTranslation,
-	  RECTL *DestRect,
-	  POINTL *SourcePoint,
-	  POINTL *MaskOrigin,
-	  BRUSHOBJ *Brush,
-	  POINTL *BrushOrigin,
-	  ROP4 Rop4)
+          SURFOBJ *SourceObj,
+          SURFOBJ *Mask,
+          CLIPOBJ *ClipRegion,
+          XLATEOBJ *ColorTranslation,
+          RECTL *DestRect,
+          POINTL *SourcePoint,
+          POINTL *MaskOrigin,
+          BRUSHOBJ *Brush,
+          POINTL *BrushOrigin,
+          ROP4 Rop4)
 {
-  BYTE               clippingType;
-  RECTL              CombinedRect;
-  RECT_ENUM          RectEnum;
-  BOOL               EnumMore;
-  POINTL             InputPoint;
-  RECTL              InputRect;
-  RECTL              OutputRect;
-  POINTL             Translate;
-  INTENG_ENTER_LEAVE EnterLeaveSource;
-  INTENG_ENTER_LEAVE EnterLeaveDest;
-  SURFOBJ*           InputObj;
-  SURFOBJ*           OutputObj;
-  PBLTRECTFUNC       BltRectFunc;
-  BOOLEAN            Ret = TRUE;
-  RECTL              ClipRect;
-  unsigned           i;
-  POINTL             Pt;
-  ULONG              Direction;
-  BOOL               UsesSource;
-  BOOL               UsesPattern;
-  POINTL             AdjustedBrushOrigin;
-
-  UsesSource = ROP4_USES_SOURCE(Rop4);
-  UsesPattern = ROP4_USES_PATTERN(Rop4);
-  if (R4_NOOP == Rop4)
-    {
-    /* Copy destination onto itself: nop */
-    return TRUE;
-    }
-
-  OutputRect = *DestRect;
-  if (OutputRect.right < OutputRect.left)
-    {
-    OutputRect.left = DestRect->right;
-    OutputRect.right = DestRect->left;
-    }
-  if (OutputRect.bottom < OutputRect.top)
-    {
-    OutputRect.left = DestRect->right;
-    OutputRect.right = DestRect->left;
-    }
-
-  if (UsesSource)
-    {
-    if (NULL == SourcePoint)
-      {
-      return FALSE;
-      }
-
-    /* Make sure we don't try to copy anything outside the valid source
-       region */
-    InputPoint = *SourcePoint;
-    if (InputPoint.x < 0)
-      {
-        OutputRect.left -= InputPoint.x;
-        InputPoint.x = 0;
-      }
-    if (InputPoint.y < 0)
-      {
-        OutputRect.top -= InputPoint.y;
-        InputPoint.y = 0;
-      }
-    if (SourceObj->sizlBitmap.cx < InputPoint.x +
-                                   OutputRect.right - OutputRect.left)
-      {
-        OutputRect.right = OutputRect.left +
-                           SourceObj->sizlBitmap.cx - InputPoint.x;
-      }
-    if (SourceObj->sizlBitmap.cy < InputPoint.y +
-                                   OutputRect.bottom - OutputRect.top)
-      {
-        OutputRect.bottom = OutputRect.top +
-                            SourceObj->sizlBitmap.cy - InputPoint.y;
-      }
-
-    InputRect.left = InputPoint.x;
-    InputRect.right = InputPoint.x + (OutputRect.right - OutputRect.left);
-    InputRect.top = InputPoint.y;
-    InputRect.bottom = InputPoint.y + (OutputRect.bottom - OutputRect.top);
-
-    if (! IntEngEnter(&EnterLeaveSource, SourceObj, &InputRect, TRUE,
-                      &Translate, &InputObj))
-      {
-      return FALSE;
-      }
-
-    InputPoint.x += Translate.x;
-    InputPoint.y += Translate.y;
-    }
-  else
-    {
-    InputRect.left = 0;
-    InputRect.right = DestRect->right - DestRect->left;
-    InputRect.top = 0;
-    InputRect.bottom = DestRect->bottom - DestRect->top;
-    }
-
-  if (NULL != ClipRegion)
-    {
-      if (OutputRect.left < ClipRegion->rclBounds.left)
-	{
-	  InputRect.left += ClipRegion->rclBounds.left - OutputRect.left;
-	  InputPoint.x += ClipRegion->rclBounds.left - OutputRect.left;
-	  OutputRect.left = ClipRegion->rclBounds.left;
-	}
-      if (ClipRegion->rclBounds.right < OutputRect.right)
-	{
-	  InputRect.right -=  OutputRect.right - ClipRegion->rclBounds.right;
-	  OutputRect.right = ClipRegion->rclBounds.right;
-	}
-      if (OutputRect.top < ClipRegion->rclBounds.top)
-	{
-	  InputRect.top += ClipRegion->rclBounds.top - OutputRect.top;
-	  InputPoint.y += ClipRegion->rclBounds.top - OutputRect.top;
-	  OutputRect.top = ClipRegion->rclBounds.top;
-	}
-      if (ClipRegion->rclBounds.bottom < OutputRect.bottom)
-	{
-	  InputRect.bottom -=  OutputRect.bottom - ClipRegion->rclBounds.bottom;
-	  OutputRect.bottom = ClipRegion->rclBounds.bottom;
-	}
-    }
-
-  /* Check for degenerate case: if height or width of OutputRect is 0 pixels
-     there's nothing to do */
-  if (OutputRect.right <= OutputRect.left ||
-      OutputRect.bottom <= OutputRect.top)
-    {
+    BYTE               clippingType;
+    RECTL              CombinedRect;
+    RECT_ENUM          RectEnum;
+    BOOL               EnumMore;
+    POINTL             InputPoint;
+    RECTL              InputRect;
+    RECTL              OutputRect;
+    POINTL             Translate;
+    INTENG_ENTER_LEAVE EnterLeaveSource;
+    INTENG_ENTER_LEAVE EnterLeaveDest;
+    SURFOBJ*           InputObj;
+    SURFOBJ*           OutputObj;
+    PBLTRECTFUNC       BltRectFunc;
+    BOOLEAN            Ret = TRUE;
+    RECTL              ClipRect;
+    unsigned           i;
+    POINTL             Pt;
+    ULONG              Direction;
+    BOOL               UsesSource;
+    BOOL               UsesPattern;
+    POINTL             AdjustedBrushOrigin;
+
+    UsesSource = ROP4_USES_SOURCE(Rop4);
+    UsesPattern = ROP4_USES_PATTERN(Rop4);
+    if (R4_NOOP == Rop4)
+    {
+        /* Copy destination onto itself: nop */
+        return TRUE;
+    }
+
+    OutputRect = *DestRect;
+    if (OutputRect.right < OutputRect.left)
+    {
+        OutputRect.left = DestRect->right;
+        OutputRect.right = DestRect->left;
+    }
+    if (OutputRect.bottom < OutputRect.top)
+    {
+        OutputRect.left = DestRect->right;
+        OutputRect.right = DestRect->left;
+    }
+
     if (UsesSource)
-      {
-      IntEngLeave(&EnterLeaveSource);
-      }
-    return TRUE;
-    }
-
-  if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate,
-                    &OutputObj))
-    {
+    {
+        if (NULL == SourcePoint)
+        {
+            return FALSE;
+        }
+
+        /* Make sure we don't try to copy anything outside the valid source
+           region */
+        InputPoint = *SourcePoint;
+        if (InputPoint.x < 0)
+        {
+            OutputRect.left -= InputPoint.x;
+            InputPoint.x = 0;
+        }
+        if (InputPoint.y < 0)
+        {
+            OutputRect.top -= InputPoint.y;
+            InputPoint.y = 0;
+        }
+        if (SourceObj->sizlBitmap.cx < InputPoint.x +
+                OutputRect.right - OutputRect.left)
+        {
+            OutputRect.right = OutputRect.left +
+                               SourceObj->sizlBitmap.cx - InputPoint.x;
+        }
+        if (SourceObj->sizlBitmap.cy < InputPoint.y +
+                OutputRect.bottom - OutputRect.top)
+        {
+            OutputRect.bottom = OutputRect.top +
+                                SourceObj->sizlBitmap.cy - InputPoint.y;
+        }
+
+        InputRect.left = InputPoint.x;
+        InputRect.right = InputPoint.x + (OutputRect.right - OutputRect.left);
+        InputRect.top = InputPoint.y;
+        InputRect.bottom = InputPoint.y + (OutputRect.bottom - OutputRect.top);
+
+        if (! IntEngEnter(&EnterLeaveSource, SourceObj, &InputRect, TRUE,
+                          &Translate, &InputObj))
+        {
+            return FALSE;
+        }
+
+        InputPoint.x += Translate.x;
+        InputPoint.y += Translate.y;
+    }
+    else
+    {
+        InputRect.left = 0;
+        InputRect.right = DestRect->right - DestRect->left;
+        InputRect.top = 0;
+        InputRect.bottom = DestRect->bottom - DestRect->top;
+    }
+
+    if (NULL != ClipRegion)
+    {
+        if (OutputRect.left < ClipRegion->rclBounds.left)
+        {
+            InputRect.left += ClipRegion->rclBounds.left - OutputRect.left;
+            InputPoint.x += ClipRegion->rclBounds.left - OutputRect.left;
+            OutputRect.left = ClipRegion->rclBounds.left;
+        }
+        if (ClipRegion->rclBounds.right < OutputRect.right)
+        {
+            InputRect.right -=  OutputRect.right - ClipRegion->rclBounds.right;
+            OutputRect.right = ClipRegion->rclBounds.right;
+        }
+        if (OutputRect.top < ClipRegion->rclBounds.top)
+        {
+            InputRect.top += ClipRegion->rclBounds.top - OutputRect.top;
+            InputPoint.y += ClipRegion->rclBounds.top - OutputRect.top;
+            OutputRect.top = ClipRegion->rclBounds.top;
+        }
+        if (ClipRegion->rclBounds.bottom < OutputRect.bottom)
+        {
+            InputRect.bottom -=  OutputRect.bottom - ClipRegion->rclBounds.bottom;
+            OutputRect.bottom = ClipRegion->rclBounds.bottom;
+        }
+    }
+
+    /* Check for degenerate case: if height or width of OutputRect is 0 pixels
+       there's nothing to do */
+    if (OutputRect.right <= OutputRect.left ||
+            OutputRect.bottom <= OutputRect.top)
+    {
+        if (UsesSource)
+        {
+            IntEngLeave(&EnterLeaveSource);
+        }
+        return TRUE;
+    }
+
+    if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate,
+                      &OutputObj))
+    {
+        if (UsesSource)
+        {
+            IntEngLeave(&EnterLeaveSource);
+        }
+        return FALSE;
+    }
+
+    OutputRect.left += Translate.x;
+    OutputRect.right += Translate.x;
+    OutputRect.top += Translate.y;
+    OutputRect.bottom += Translate.y;
+
+    if (BrushOrigin)
+    {
+        AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
+        AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
+    }
+    else
+    {
+        AdjustedBrushOrigin = Translate;
+    }
+
+    /* Determine clipping type */
+    if (ClipRegion == (CLIPOBJ *) NULL)
+    {
+        clippingType = DC_TRIVIAL;
+    }
+    else
+    {
+        clippingType = ClipRegion->iDComplexity;
+    }
+
+    if (R4_MASK == Rop4)
+    {
+        BltRectFunc = BltMask;
+    }
+    else if (ROP3_TO_ROP4(PATCOPY) == Rop4)
+    {
+        if (Brush->iSolidColor == 0xFFFFFFFF)
+            BltRectFunc = CallDibBitBlt;
+        else
+            BltRectFunc = BltPatCopy;
+    }
+    else
+    {
+        BltRectFunc = CallDibBitBlt;
+    }
+
+
+    switch (clippingType)
+    {
+        case DC_TRIVIAL:
+            Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ColorTranslation,
+                                 &OutputRect, &InputPoint, MaskOrigin, Brush,
+                                 &AdjustedBrushOrigin, Rop4);
+            break;
+        case DC_RECT:
+            /* 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;
+            ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
+            if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+            {
+                Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
+                Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
+                Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ColorTranslation,
+                                     &CombinedRect, &Pt, MaskOrigin, Brush,
+                                     &AdjustedBrushOrigin, Rop4);
+            }
+            break;
+        case DC_COMPLEX:
+            Ret = TRUE;
+            if (OutputObj == InputObj)
+            {
+                if (OutputRect.top < InputPoint.y)
+                {
+                    Direction = OutputRect.left < InputPoint.x ?
+                                CD_RIGHTDOWN : CD_LEFTDOWN;
+                }
+                else
+                {
+                    Direction = OutputRect.left < InputPoint.x ?
+                                CD_RIGHTUP : CD_LEFTUP;
+                }
+            }
+            else
+            {
+                Direction = CD_ANY;
+            }
+            CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, Direction, 0);
+            do
+            {
+                EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum),
+                                         (PVOID) &RectEnum);
+
+                for (i = 0; i < RectEnum.c; i++)
+                {
+                    ClipRect.left = RectEnum.arcl[i].left + Translate.x;
+                    ClipRect.right = RectEnum.arcl[i].right + Translate.x;
+                    ClipRect.top = RectEnum.arcl[i].top + Translate.y;
+                    ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
+                    if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+                    {
+                        Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
+                        Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
+                        Ret = (*BltRectFunc)(OutputObj, InputObj, Mask,
+                                             ColorTranslation, &CombinedRect, &Pt,
+                                             MaskOrigin, Brush, &AdjustedBrushOrigin,
+                                             Rop4) && Ret;
+                    }
+                }
+            }
+            while (EnumMore);
+            break;
+    }
+
+
+    IntEngLeave(&EnterLeaveDest);
     if (UsesSource)
-      {
-      IntEngLeave(&EnterLeaveSource);
-      }
-    return FALSE;
-    }
-
-  OutputRect.left += Translate.x;
-  OutputRect.right += Translate.x;
-  OutputRect.top += Translate.y;
-  OutputRect.bottom += Translate.y;
-
-  if(BrushOrigin)
-    {
-    AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
-    AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
-    }
-  else
-    {
-    AdjustedBrushOrigin = Translate;
-    }
-
-  /* Determine clipping type */
-  if (ClipRegion == (CLIPOBJ *) NULL)
-    {
-    clippingType = DC_TRIVIAL;
-    }
-  else
-    {
-    clippingType = ClipRegion->iDComplexity;
-    }
-
-  if (R4_MASK == Rop4)
-    {
-      BltRectFunc = BltMask;
-    }
-  else if (ROP3_TO_ROP4(PATCOPY) == Rop4)
-    {
-      if (Brush->iSolidColor == 0xFFFFFFFF)
-        BltRectFunc = CallDibBitBlt;
-      else
-        BltRectFunc = BltPatCopy;
-    }
-  else
-    {
-      BltRectFunc = CallDibBitBlt;
-    }
-
-
-  switch(clippingType)
-  {
-    case DC_TRIVIAL:
-      Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ColorTranslation,
-                           &OutputRect, &InputPoint, MaskOrigin, Brush,
-                           &AdjustedBrushOrigin, Rop4);
-      break;
-    case DC_RECT:
-      /* 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;
-      ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
-      if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
-        {
-          Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
-          Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
-          Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ColorTranslation,
-                               &CombinedRect, &Pt, MaskOrigin, Brush,
-                               &AdjustedBrushOrigin, Rop4);
-        }
-      break;
-    case DC_COMPLEX:
-      Ret = TRUE;
-      if (OutputObj == InputObj)
-	{
-	  if (OutputRect.top < InputPoint.y)
-	    {
-	      Direction = OutputRect.left < InputPoint.x ?
-                          CD_RIGHTDOWN : CD_LEFTDOWN;
-	    }
-	  else
-	    {
-	      Direction = OutputRect.left < InputPoint.x ?
-                          CD_RIGHTUP : CD_LEFTUP;
-	    }
-	}
-      else
-	{
-	  Direction = CD_ANY;
-	}
-      CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, Direction, 0);
-      do
-	{
-	  EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum),
-                                   (PVOID) &RectEnum);
-
-	  for (i = 0; i < RectEnum.c; i++)
-	    {
-	      ClipRect.left = RectEnum.arcl[i].left + Translate.x;
-	      ClipRect.right = RectEnum.arcl[i].right + Translate.x;
-	      ClipRect.top = RectEnum.arcl[i].top + Translate.y;
-	      ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
-	      if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
-                {
-                  Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
-                  Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
-                  Ret = (*BltRectFunc)(OutputObj, InputObj, Mask,
-                                       ColorTranslation, &CombinedRect, &Pt,
-                                       MaskOrigin, Brush, &AdjustedBrushOrigin,
-                                       Rop4) && Ret;
-                }
-	    }
-	}
-      while(EnumMore);
-      break;
-  }
-
-
-  IntEngLeave(&EnterLeaveDest);
-  if (UsesSource)
-    {
-    IntEngLeave(&EnterLeaveSource);
-    }
-
-  return Ret;
+    {
+        IntEngLeave(&EnterLeaveSource);
+    }
+
+    return Ret;
 }
 
 BOOL STDCALL
@@ -543,154 +543,154 @@
                ROP4 Rop4,
                BOOL RemoveMouse)
 {
-  BOOLEAN ret;
-  RECTL InputClippedRect;
-  RECTL OutputRect;
-  POINTL InputPoint;
-  BOOLEAN UsesSource;
-  BITMAPOBJ *DestObj;
-  BITMAPOBJ *SourceObj = NULL;
-
-  if (DestSurf == NULL)
-    return FALSE;
-
-  ASSERT(DestSurf);
-  DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
-  ASSERT(DestObj);
-
-  InputClippedRect = *DestRect;
-  if (InputClippedRect.right < InputClippedRect.left)
-    {
-      InputClippedRect.left = DestRect->right;
-      InputClippedRect.right = DestRect->left;
-    }
-  if (InputClippedRect.bottom < InputClippedRect.top)
-    {
-      InputClippedRect.top = DestRect->bottom;
-      InputClippedRect.bottom = DestRect->top;
-    }
-  UsesSource = ROP4_USES_SOURCE(Rop4);
-  if (UsesSource)
-    {
-      if (NULL == SourcePoint || NULL == SourceSurf)
-        {
-          return FALSE;
-        }
-      InputPoint = *SourcePoint;
-
-      /* Make sure we don't try to copy anything outside the valid source
-         region */
-      if (InputPoint.x < 0)
-        {
-          InputClippedRect.left -= InputPoint.x;
-          InputPoint.x = 0;
-        }
-      if (InputPoint.y < 0)
-        {
-          InputClippedRect.top -= InputPoint.y;
-          InputPoint.y = 0;
-        }
-      if (SourceSurf->sizlBitmap.cx < InputPoint.x +
-                                      InputClippedRect.right -
-                                      InputClippedRect.left)
-        {
-          InputClippedRect.right = InputClippedRect.left +
-                                   SourceSurf->sizlBitmap.cx - InputPoint.x;
-        }
-      if (SourceSurf->sizlBitmap.cy < InputPoint.y +
-                                      InputClippedRect.bottom -
-                                      InputClippedRect.top)
-        {
-          InputClippedRect.bottom = InputClippedRect.top +
-                                    SourceSurf->sizlBitmap.cy - InputPoint.y;
-        }
-
-      if (InputClippedRect.right < InputClippedRect.left ||
-          InputClippedRect.bottom < InputClippedRect.top)
-        {
-          /* Everything clipped away, nothing to do */
-          return TRUE;
-        }
-    }
-
-  /* Clip against the bounds of the clipping region so we won't try to write
-   * outside the surface */
-  if (NULL != ClipRegion)
-    {
-      if (! EngIntersectRect(&OutputRect, &InputClippedRect,
-                             &ClipRegion->rclBounds))
-	{
-	  return TRUE;
-	}
-      InputPoint.x += OutputRect.left - InputClippedRect.left;
-      InputPoint.y += OutputRect.top - InputClippedRect.top;
-    }
-  else
-    {
-      OutputRect = InputClippedRect;
-    }
-
-  if (RemoveMouse)
-    {
-    BITMAPOBJ_LockBitmapBits(DestObj);
-
+    BOOLEAN ret;
+    RECTL InputClippedRect;
+    RECTL OutputRect;
+    POINTL InputPoint;
+    BOOLEAN UsesSource;
+    BITMAPOBJ *DestObj;
+    BITMAPOBJ *SourceObj = NULL;
+
+    if (DestSurf == NULL)
+        return FALSE;
+
+    ASSERT(DestSurf);
+    DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
+    ASSERT(DestObj);
+
+    InputClippedRect = *DestRect;
+    if (InputClippedRect.right < InputClippedRect.left)
+    {
+        InputClippedRect.left = DestRect->right;
+        InputClippedRect.right = DestRect->left;
+    }
+    if (InputClippedRect.bottom < InputClippedRect.top)
+    {
+        InputClippedRect.top = DestRect->bottom;
+        InputClippedRect.bottom = DestRect->top;
+    }
+    UsesSource = ROP4_USES_SOURCE(Rop4);
     if (UsesSource)
-      {
-      if (SourceSurf != DestSurf)
-        {
-        SourceObj = CONTAINING_RECORD(SourceSurf, BITMAPOBJ, SurfObj);
-        BITMAPOBJ_LockBitmapBits(SourceObj);
-        }
-      MouseSafetyOnDrawStart(SourceSurf, InputPoint.x, InputPoint.y,
-                             (InputPoint.x + abs(DestRect->right - DestRect->left)),
-  			   (InputPoint.y + abs(DestRect->bottom - DestRect->top)));
-      }
-    MouseSafetyOnDrawStart(DestSurf, OutputRect.left, OutputRect.top,
-                           OutputRect.right, OutputRect.bottom);
-    }
-
-  /* No success yet */
-  ret = FALSE;
-
-  /* Call the driver's DrvBitBlt if available */
-  if (DestObj->flHooks & HOOK_BITBLT)
-    {
-      ret = GDIDEVFUNCS(DestSurf).BitBlt(
-                            DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
-                            &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
-                            Rop4);
-    }
-
-  if (! ret)
-    {
-      ret = EngBitBlt(DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
-                      &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
-                      Rop4);
-    }
-
-  if (RemoveMouse)
-    {
-    MouseSafetyOnDrawEnd(DestSurf);
-    if (UsesSource)
-      {
-      MouseSafetyOnDrawEnd(SourceSurf);
-      if (SourceSurf != DestSurf)
-        {
-        BITMAPOBJ_UnlockBitmapBits(SourceObj);
-        }
-      }
-
-    BITMAPOBJ_UnlockBitmapBits(DestObj);
-    }
-
-  return ret;
+    {
+        if (NULL == SourcePoint || NULL == SourceSurf)
+        {
+            return FALSE;
+        }
+        InputPoint = *SourcePoint;
+
+        /* Make sure we don't try to copy anything outside the valid source
+           region */
+        if (InputPoint.x < 0)
+        {
+            InputClippedRect.left -= InputPoint.x;
+            InputPoint.x = 0;
+        }
+        if (InputPoint.y < 0)
+        {
+            InputClippedRect.top -= InputPoint.y;
+            InputPoint.y = 0;
+        }
+        if (SourceSurf->sizlBitmap.cx < InputPoint.x +
+                InputClippedRect.right -
+                InputClippedRect.left)
+        {
+            InputClippedRect.right = InputClippedRect.left +
+                                     SourceSurf->sizlBitmap.cx - InputPoint.x;
+        }
+        if (SourceSurf->sizlBitmap.cy < InputPoint.y +
+                InputClippedRect.bottom -
+                InputClippedRect.top)
+        {
+            InputClippedRect.bottom = InputClippedRect.top +
+                                      SourceSurf->sizlBitmap.cy - InputPoint.y;
+        }
+
+        if (InputClippedRect.right < InputClippedRect.left ||
+                InputClippedRect.bottom < InputClippedRect.top)
+        {
+            /* Everything clipped away, nothing to do */
+            return TRUE;
+        }
+    }
+
+    /* Clip against the bounds of the clipping region so we won't try to write
+     * outside the surface */
+    if (NULL != ClipRegion)
+    {
+        if (! EngIntersectRect(&OutputRect, &InputClippedRect,
+                               &ClipRegion->rclBounds))
+        {
+            return TRUE;
+        }
+        InputPoint.x += OutputRect.left - InputClippedRect.left;
+        InputPoint.y += OutputRect.top - InputClippedRect.top;
+    }
+    else
+    {
+        OutputRect = InputClippedRect;
+    }
+
+    if (RemoveMouse)
+    {
+        BITMAPOBJ_LockBitmapBits(DestObj);
+
+        if (UsesSource)
+        {
+            if (SourceSurf != DestSurf)
+            {
+                SourceObj = CONTAINING_RECORD(SourceSurf, BITMAPOBJ, SurfObj);
+                BITMAPOBJ_LockBitmapBits(SourceObj);
+            }
+            MouseSafetyOnDrawStart(SourceSurf, InputPoint.x, InputPoint.y,
+                                   (InputPoint.x + abs(DestRect->right - DestRect->left)),
+                                   (InputPoint.y + abs(DestRect->bottom - DestRect->top)));
+        }
+        MouseSafetyOnDrawStart(DestSurf, OutputRect.left, OutputRect.top,
+                               OutputRect.right, OutputRect.bottom);
+    }
+
+    /* No success yet */
+    ret = FALSE;
+
+    /* Call the driver's DrvBitBlt if available */
+    if (DestObj->flHooks & HOOK_BITBLT)
+    {
+        ret = GDIDEVFUNCS(DestSurf).BitBlt(
+                  DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
+                  &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
+                  Rop4);
+    }
+
+    if (! ret)
+    {
+        ret = EngBitBlt(DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
+                        &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
+                        Rop4);
+    }
+
+    if (RemoveMouse)
+    {
+        MouseSafetyOnDrawEnd(DestSurf);
+        if (UsesSource)
+        {
+            MouseSafetyOnDrawEnd(SourceSurf);
+            if (SourceSurf != DestSurf)
+            {
+                BITMAPOBJ_UnlockBitmapBits(SourceObj);
+            }
+        }
+
+        BITMAPOBJ_UnlockBitmapBits(DestObj);
+    }
+
+    return ret;
 }
 
 static BOOLEAN STDCALL
 CallDibStretchBlt(SURFOBJ* OutputObj,
                   SURFOBJ* InputObj,
                   SURFOBJ* Mask,
-	          CLIPOBJ* ClipRegion,
+                  CLIPOBJ* ClipRegion,
                   XLATEOBJ* ColorTranslation,
                   RECTL* OutputRect,
                   RECTL* InputRect,
@@ -698,117 +698,117 @@
                   POINTL* BrushOrigin,
                   ULONG Mode)
 {
-  POINTL RealBrushOrigin;
-  if (BrushOrigin == NULL)
-    {
-      RealBrushOrigin.x = RealBrushOrigin.y = 0;
-    }
-  else
-    {
-      RealBrushOrigin = *BrushOrigin;
-    }
-  return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_StretchBlt(
-    OutputObj, InputObj, OutputRect, InputRect, MaskOrigin, RealBrushOrigin, ClipRegion, ColorTranslation, Mode);
+    POINTL RealBrushOrigin;
+    if (BrushOrigin == NULL)
+    {
+        RealBrushOrigin.x = RealBrushOrigin.y = 0;
+    }
+    else
+    {
+        RealBrushOrigin = *BrushOrigin;
+    }
+    return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_StretchBlt(
+               OutputObj, InputObj, OutputRect, InputRect, MaskOrigin, RealBrushOrigin, ClipRegion, ColorTranslation, Mode);
 }
 
 
 BOOL
 STDCALL
 EngStretchBlt(
-	IN SURFOBJ  *DestObj,
-	IN SURFOBJ  *SourceObj,
-	IN SURFOBJ  *Mask,
-	IN CLIPOBJ  *ClipRegion,
-	IN XLATEOBJ  *ColorTranslation,
-	IN COLORADJUSTMENT  *pca,
-	IN POINTL  *BrushOrigin,
-	IN RECTL  *prclDest,
-	IN RECTL  *prclSrc,
-	IN POINTL  *MaskOrigin,
-	IN ULONG  Mode
-	)
+    IN SURFOBJ  *DestObj,
+    IN SURFOBJ  *SourceObj,
+    IN SURFOBJ  *Mask,
+    IN CLIPOBJ  *ClipRegion,
+    IN XLATEOBJ  *ColorTranslation,
+    IN COLORADJUSTMENT  *pca,
+    IN POINTL  *BrushOrigin,
+    IN RECTL  *prclDest,
+    IN RECTL  *prclSrc,
+    IN POINTL  *MaskOrigin,
+    IN ULONG  Mode
+)
 {
-  // www.osr.com/ddk/graphics/gdifncs_0bs7.htm
-
-  POINTL             InputPoint;
-  RECTL              InputRect;
-  RECTL              OutputRect;
-  POINTL             Translate;
-  INTENG_ENTER_LEAVE EnterLeaveSource;
-  INTENG_ENTER_LEAVE EnterLeaveDest;
-  SURFOBJ*           InputObj;
-  SURFOBJ*           OutputObj;
-  PSTRETCHRECTFUNC   BltRectFunc;
-  BOOLEAN            Ret;
-  POINTL             AdjustedBrushOrigin;
-
-  InputRect.left = prclSrc->left;
-  InputRect.right = prclSrc->right;
-  InputRect.top = prclSrc->top;
-  InputRect.bottom = prclSrc->bottom;
-
-  if (! IntEngEnter(&EnterLeaveSource, SourceObj, &InputRect, TRUE, &Translate, &InputObj))
-    {
-      return FALSE;
-    }
-
-  InputPoint.x = InputRect.left + Translate.x;
-  InputPoint.y = InputRect.top + Translate.y;
-
-  OutputRect = *prclDest;
-
-  /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
-     nothing to do */
-  if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
-    {
-      IntEngLeave(&EnterLeaveSource);
-      return TRUE;
-    }
-
-  if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
-    {
-      IntEngLeave(&EnterLeaveSource);
-      return FALSE;
-    }
-
-  OutputRect.left = prclDest->left + Translate.x;
-  OutputRect.right = prclDest->right + Translate.x;
-  OutputRect.top = prclDest->top + Translate.y;
-  OutputRect.bottom = prclDest->bottom + Translate.y;
-
-  if (NULL != BrushOrigin)
-    {
-      AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
-      AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
-    }
-  else
-    {
-      AdjustedBrushOrigin = Translate;
-    }
-
-  if (Mask != NULL)
-    {
-      //BltRectFunc = BltMask;
-      DPRINT("EngStretchBlt isn't capable of handling mask yet.\n");
-      IntEngLeave(&EnterLeaveDest);
-      IntEngLeave(&EnterLeaveSource);
-
-      return FALSE;
-    }
-  else
-    {
-      BltRectFunc = CallDibStretchBlt;
-    }
-
-
-  Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ClipRegion,
-                       ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
-                       &AdjustedBrushOrigin, Mode);
-
-  IntEngLeave(&EnterLeaveDest);
-  IntEngLeave(&EnterLeaveSource);
-
-  return Ret;
+    // www.osr.com/ddk/graphics/gdifncs_0bs7.htm
+
+    POINTL             InputPoint;
+    RECTL              InputRect;
+    RECTL              OutputRect;
+    POINTL             Translate;
+    INTENG_ENTER_LEAVE EnterLeaveSource;
+    INTENG_ENTER_LEAVE EnterLeaveDest;
+    SURFOBJ*           InputObj;
+    SURFOBJ*           OutputObj;
+    PSTRETCHRECTFUNC   BltRectFunc;
+    BOOLEAN            Ret;
+    POINTL             AdjustedBrushOrigin;
+
+    InputRect.left = prclSrc->left;
+    InputRect.right = prclSrc->right;
+    InputRect.top = prclSrc->top;
+    InputRect.bottom = prclSrc->bottom;
+
+    if (! IntEngEnter(&EnterLeaveSource, SourceObj, &InputRect, TRUE, &Translate, &InputObj))
+    {
+        return FALSE;
+    }
+
+    InputPoint.x = InputRect.left + Translate.x;
+    InputPoint.y = InputRect.top + Translate.y;
+
+    OutputRect = *prclDest;
+
+    /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
+       nothing to do */
+    if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
+    {
+        IntEngLeave(&EnterLeaveSource);
+        return TRUE;
+    }
+
+    if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
+    {
+        IntEngLeave(&EnterLeaveSource);
+        return FALSE;
+    }
+
+    OutputRect.left = prclDest->left + Translate.x;
+    OutputRect.right = prclDest->right + Translate.x;
+    OutputRect.top = prclDest->top + Translate.y;
+    OutputRect.bottom = prclDest->bottom + Translate.y;
+
+    if (NULL != BrushOrigin)
+    {
+        AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
+        AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
+    }
+    else
+    {
+        AdjustedBrushOrigin = Translate;
+    }
+
+    if (Mask != NULL)
+    {
+        //BltRectFunc = BltMask;
+        DPRINT("EngStretchBlt isn't capable of handling mask yet.\n");
+        IntEngLeave(&EnterLeaveDest);
+        IntEngLeave(&EnterLeaveSource);
+
+        return FALSE;
+    }
+    else
+    {
+        BltRectFunc = CallDibStretchBlt;
+    }
+
+
+    Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, ClipRegion,
+                         ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
+                         &AdjustedBrushOrigin, Mode);
+
+    IntEngLeave(&EnterLeaveDest);
+    IntEngLeave(&EnterLeaveSource);
+
+    return Ret;
 }
 
 BOOL STDCALL
@@ -824,72 +824,72 @@
                  POINTL *BrushOrigin,
                  ULONG Mode)
 {
-  BOOLEAN ret;
-  COLORADJUSTMENT ca;
-  POINT MaskOrigin;
-  BITMAPOBJ *DestObj;
-  BITMAPOBJ *SourceObj = NULL;
-
-  ASSERT(DestSurf);
-  DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
-  ASSERT(DestObj);
-
-  if (pMaskOrigin != NULL)
-    {
-      MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;
-    }
-
-  /* No success yet */
-  ret = FALSE;
-  ASSERT(DestRect);
-  BITMAPOBJ_LockBitmapBits(DestObj);
-  MouseSafetyOnDrawStart(DestSurf, DestRect->left, DestRect->top,
-                         DestRect->right, DestRect->bottom);
-
-  if (NULL != SourceSurf)
-    {
-    SourceObj = CONTAINING_RECORD(SourceSurf, BITMAPOBJ, SurfObj);
-    ASSERT(SourceRect);
-    if (SourceSurf != DestSurf)
-      {
-      BITMAPOBJ_LockBitmapBits(SourceObj);
-      }
-    MouseSafetyOnDrawStart(SourceSurf, SourceRect->left, SourceRect->top,
-                           SourceRect->right, SourceRect->bottom);
-    }
-
-  /* Prepare color adjustment */
-
-  /* Call the driver's DrvStretchBlt if available */
-  if (DestObj->flHooks & HOOK_STRETCHBLT)
-    {
-      /* Drv->StretchBlt (look at http://www.osr.com/ddk/graphics/ddifncs_3ew7.htm )
-      SURFOBJ *psoMask // optional, if it exists, then rop4=0xCCAA, otherwise rop4=0xCCCC */
-      // FIXME: MaskOrigin is always NULL !
-      ret = GDIDEVFUNCS(DestSurf).StretchBlt(
-                            DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
+    BOOLEAN ret;
+    COLORADJUSTMENT ca;
+    POINT MaskOrigin;
+    BITMAPOBJ *DestObj;
+    BITMAPOBJ *SourceObj = NULL;
+
+    ASSERT(DestSurf);
+    DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
+    ASSERT(DestObj);
+
+    if (pMaskOrigin != NULL)
+    {
+        MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;
+    }
+
+    /* No success yet */
+    ret = FALSE;
+    ASSERT(DestRect);
+    BITMAPOBJ_LockBitmapBits(DestObj);
+    MouseSafetyOnDrawStart(DestSurf, DestRect->left, DestRect->top,
+                           DestRect->right, DestRect->bottom);
+
+    if (NULL != SourceSurf)
+    {
+        SourceObj = CONTAINING_RECORD(SourceSurf, BITMAPOBJ, SurfObj);
+        ASSERT(SourceRect);
+        if (SourceSurf != DestSurf)
+        {
+            BITMAPOBJ_LockBitmapBits(SourceObj);
+        }
+        MouseSafetyOnDrawStart(SourceSurf, SourceRect->left, SourceRect->top,
+                               SourceRect->right, SourceRect->bottom);
+    }
+
+    /* Prepare color adjustment */
+
+    /* Call the driver's DrvStretchBlt if available */
+    if (DestObj->flHooks & HOOK_STRETCHBLT)
+    {
+        /* Drv->StretchBlt (look at http://www.osr.com/ddk/graphics/ddifncs_3ew7.htm )
+        SURFOBJ *psoMask // optional, if it exists, then rop4=0xCCAA, otherwise rop4=0xCCCC */
+        // FIXME: MaskOrigin is always NULL !
+        ret = GDIDEVFUNCS(DestSurf).StretchBlt(
+                  DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
+                  &ca, BrushOrigin, DestRect, SourceRect, NULL, Mode);
+    }
+
+    if (! ret)
+    {
+        // FIXME: see previous fixme
+        ret = EngStretchBlt(DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
                             &ca, BrushOrigin, DestRect, SourceRect, NULL, Mode);
     }
 
-  if (! ret)
-    {
-      // FIXME: see previous fixme
-      ret = EngStretchBlt(DestSurf, SourceSurf, MaskSurf, ClipRegion, ColorTranslation,
-                          &ca, BrushOrigin, DestRect, SourceRect, NULL, Mode);
-    }
-
-  if (NULL != SourceSurf)
-    {
-    MouseSafetyOnDrawEnd(SourceSurf);
-    if (SourceSurf != DestSurf)
-      {
-      BITMAPOBJ_UnlockBitmapBits(SourceObj);
-      }
-    }
-  MouseSafetyOnDrawEnd(DestSurf);
-  BITMAPOBJ_UnlockBitmapBits(DestObj);
-
-  return ret;
+    if (NULL != SourceSurf)
+    {
+        MouseSafetyOnDrawEnd(SourceSurf);
+        if (SourceSurf != DestSurf)
+        {
+            BITMAPOBJ_UnlockBitmapBits(SourceObj);
+        }
+    }
+    MouseSafetyOnDrawEnd(DestSurf);
+    BITMAPOBJ_UnlockBitmapBits(DestObj);
+
+    return ret;
 }
 
 BOOL
@@ -902,245 +902,245 @@
               IN PRECTL SourceRect,
               IN BLENDOBJ *BlendObj)
 {
-  RECTL              SourceStretchedRect;
-  SIZEL              SourceStretchedSize;
-  HBITMAP            SourceStretchedBitmap = 0;
-  SURFOBJ*           SourceStretchedObj = NULL;
-  RECTL              InputRect;
-  RECTL              OutputRect;
-  RECTL              ClipRect;
-  RECTL              CombinedRect;
-  RECTL              Rect;
-  POINTL             Translate;
-  INTENG_ENTER_LEAVE EnterLeaveSource;
-  INTENG_ENTER_LEAVE EnterLeaveDest;
-  SURFOBJ*           InputObj;
-  SURFOBJ*           OutputObj;
-  LONG               Width;
-  LONG               ClippingType;
-  RECT_ENUM          RectEnum;
-  BOOL               EnumMore;
-  INT                i;
-  BOOLEAN            Ret;
-
-  DPRINT("EngAlphaBlend(Dest:0x%p, Source:0x%p, ClipRegion:0x%p, ColorTranslation:0x%p,\n", Dest, Source, ClipRegion, ColorTranslation);
-  DPRINT("              DestRect:{0x%x, 0x%x, 0x%x, 0x%x}, SourceRect:{0x%x, 0x%x, 0x%x, 0x%x},\n",
-         DestRect->left, DestRect->top, DestRect->right, DestRect->bottom,
-         SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom);
-  DPRINT("              BlendObj:{0x%x, 0x%x, 0x%x, 0x%x}\n", BlendObj->BlendFunction.BlendOp,
-         BlendObj->BlendFunction.BlendFlags, BlendObj->BlendFunction.SourceConstantAlpha,
-         BlendObj->BlendFunction.AlphaFormat);
-
-  /* Validate input */
-  if (DestRect->left >= DestRect->right || DestRect->top >= DestRect->bottom)
-    {
-      DPRINT1("Empty destination rectangle!\n");
-      return FALSE;
-    }
-  if (SourceRect->left >= SourceRect->right || SourceRect->top >= SourceRect->bottom)
-    {
-      DPRINT1("Empty source rectangle!\n");
-      return FALSE;
-    }
-  if (Dest == Source &&
-      !(DestRect->left >= SourceRect->right || SourceRect->left >= DestRect->right ||
-        DestRect->top >= SourceRect->bottom || SourceRect->top >= DestRect->bottom))
-    {
-      DPRINT1("Source and destination rectangles overlap!\n");
-      return FALSE;
-    }
-
-  if (BlendObj->BlendFunction.BlendOp != AC_SRC_OVER)
-    {
-      DPRINT1("BlendOp != AC_SRC_OVER (0x%x)\n", BlendObj->BlendFunction.BlendOp);
-      return FALSE;
-    }
-  if (BlendObj->BlendFunction.BlendFlags != 0)
-    {
-      DPRINT1("BlendFlags != 0 (0x%x)\n", BlendObj->BlendFunction.BlendFlags);
-      return FALSE;
-    }
-  if ((BlendObj->BlendFunction.AlphaFormat & ~AC_SRC_ALPHA) != 0)
-    {
-      DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendObj->BlendFunction.AlphaFormat);
-      return FALSE;
-    }
-
-  /* Check if there is anything to draw */
-  if (ClipRegion != NULL &&
-      (ClipRegion->rclBounds.left >= ClipRegion->rclBounds.right ||
-       ClipRegion->rclBounds.top >= ClipRegion->rclBounds.bottom))
-    {
-      /* Nothing to do */
-      return TRUE;
-    }
-
-  /* Stretch source if needed */
-  if (DestRect->right - DestRect->left != SourceRect->right - SourceRect->left ||
-      DestRect->bottom - DestRect->top != SourceRect->bottom - SourceRect->top)
-    {
-      SourceStretchedSize.cx = DestRect->right - DestRect->left;
-      SourceStretchedSize.cy = DestRect->bottom - DestRect->top;
-      Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(Source->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, Source->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, Source, NULL, NULL,
-                            NULL, &SourceStretchedRect, SourceRect, NULL,
-                            NULL, NULL, COLORONCOLOR))*/
-      if (!EngStretchBlt(SourceStretchedObj, Source, NULL, NULL, NULL,
-                         NULL, NULL, &SourceStretchedRect, SourceRect,
-                         NULL, COLORONCOLOR))
-        {
-          DPRINT1("EngStretchBlt failed!\n");
-          EngFreeMem(SourceStretchedObj->pvBits);
-          EngUnlockSurface(SourceStretchedObj);
-          EngDeleteSurface((HSURF)SourceStretchedBitmap);
-          return FALSE;
-        }
-      SourceRect = &SourceStretchedRect;
-      Source = SourceStretchedObj;
-    }
-
-  /* Now call the DIB function */
-  InputRect.left = SourceRect->left;
-  InputRect.right = SourceRect->right;
-  InputRect.top = SourceRect->top;
-  InputRect.bottom = SourceRect->bottom;
-  if (!IntEngEnter(&EnterLeaveSource, Source, &InputRect, TRUE, &Translate, &InputObj))
-    {
-      if (SourceStretchedObj != NULL)
-        {
-          EngFreeMem(SourceStretchedObj->pvBits);
-          EngUnlockSurface(SourceStretchedObj);
-        }
-      if (SourceStretchedBitmap != 0)
-        {
-          EngDeleteSurface((HSURF)SourceStretchedBitmap);
-        }
-      return FALSE;
-    }
-  InputRect.left = SourceRect->left + Translate.x;
-  InputRect.right = SourceRect->right + Translate.x;
-  InputRect.top = SourceRect->top + Translate.y;
-  InputRect.bottom = SourceRect->bottom + Translate.y;
-
-  OutputRect.left = DestRect->left;
-  OutputRect.right = DestRect->right;
-  OutputRect.top = DestRect->top;
-  OutputRect.bottom = DestRect->bottom;
-  if (!IntEngEnter(&EnterLeaveDest, Dest, &OutputRect, FALSE, &Translate, &OutputObj))
-    {
-      IntEngLeave(&EnterLeaveSource);
-      if (SourceStretchedObj != NULL)
-        {
-          EngFreeMem(SourceStretchedObj->pvBits);
-          EngUnlockSurface(SourceStretchedObj);
-        }
-      if (SourceStretchedBitmap != 0)
-        {
-          EngDeleteSurface((HSURF)SourceStretchedBitmap);
-        }
-      return FALSE;
-    }
-  OutputRect.left = DestRect->left + Translate.x;
-  OutputRect.right = DestRect->right + Translate.x;
-  OutputRect.top = DestRect->top + Translate.y;
-  OutputRect.bottom = DestRect->bottom + Translate.y;
-
-  Ret = FALSE;
-  ClippingType = (ClipRegion == NULL) ? DC_TRIVIAL : ClipRegion->iDComplexity;
-  switch(ClippingType)
-    {
-    case DC_TRIVIAL:
-      Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
-                OutputObj, InputObj, &OutputRect, &InputRect, ClipRegion, ColorTranslation, BlendObj);
-      break;
-
-    case DC_RECT:
-      ClipRect.left = ClipRegion->rclBounds.left + Translate.x;
-      ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
-      ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
-      ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
-      if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
-        {
-          Rect.left = InputRect.left + CombinedRect.left - OutputRect.left;
-          Rect.right = InputRect.right + CombinedRect.right - OutputRect.right;
-          Rect.top = InputRect.top + CombinedRect.top - OutputRect.top;
-          Rect.bottom = InputRect.bottom + CombinedRect.bottom - OutputRect.bottom;
-          Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
-                    OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj);
-        }
-      break;
-
-    case DC_COMPLEX:
-      Ret = TRUE;
-      CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0);
-      do
-        {
-          EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum),
-                                   (PVOID) &RectEnum);
-
-          for (i = 0; i < RectEnum.c; i++)
+    RECTL              SourceStretchedRect;
+    SIZEL              SourceStretchedSize;
+    HBITMAP            SourceStretchedBitmap = 0;
+    SURFOBJ*           SourceStretchedObj = NULL;
+    RECTL              InputRect;
+    RECTL              OutputRect;
+    RECTL              ClipRect;
+    RECTL              CombinedRect;
+    RECTL              Rect;
+    POINTL             Translate;
+    INTENG_ENTER_LEAVE EnterLeaveSource;
+    INTENG_ENTER_LEAVE EnterLeaveDest;
+    SURFOBJ*           InputObj;
+    SURFOBJ*           OutputObj;
+    LONG               Width;
+    LONG               ClippingType;
+    RECT_ENUM          RectEnum;
+    BOOL               EnumMore;
+    INT                i;
+    BOOLEAN            Ret;
+
+    DPRINT("EngAlphaBlend(Dest:0x%p, Source:0x%p, ClipRegion:0x%p, ColorTranslation:0x%p,\n", Dest, Source, ClipRegion, ColorTranslation);
+    DPRINT("              DestRect:{0x%x, 0x%x, 0x%x, 0x%x}, SourceRect:{0x%x, 0x%x, 0x%x, 0x%x},\n",
+           DestRect->left, DestRect->top, DestRect->right, DestRect->bottom,
+           SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom);
+    DPRINT("              BlendObj:{0x%x, 0x%x, 0x%x, 0x%x}\n", BlendObj->BlendFunction.BlendOp,
+           BlendObj->BlendFunction.BlendFlags, BlendObj->BlendFunction.SourceConstantAlpha,
+           BlendObj->BlendFunction.AlphaFormat);
+
+    /* Validate input */
+    if (DestRect->left >= DestRect->right || DestRect->top >= DestRect->bottom)
+    {
+        DPRINT1("Empty destination rectangle!\n");
+        return FALSE;
+    }
+    if (SourceRect->left >= SourceRect->right || SourceRect->top >= SourceRect->bottom)
+    {
+        DPRINT1("Empty source rectangle!\n");
+        return FALSE;
+    }
+    if (Dest == Source &&
+            !(DestRect->left >= SourceRect->right || SourceRect->left >= DestRect->right ||
+              DestRect->top >= SourceRect->bottom || SourceRect->top >= DestRect->bottom))
+    {
+        DPRINT1("Source and destination rectangles overlap!\n");
+        return FALSE;
+    }
+
+    if (BlendObj->BlendFunction.BlendOp != AC_SRC_OVER)
+    {
+        DPRINT1("BlendOp != AC_SRC_OVER (0x%x)\n", BlendObj->BlendFunction.BlendOp);
+        return FALSE;
+    }
+    if (BlendObj->BlendFunction.BlendFlags != 0)
+    {
+        DPRINT1("BlendFlags != 0 (0x%x)\n", BlendObj->BlendFunction.BlendFlags);
+        return FALSE;
+    }
+    if ((BlendObj->BlendFunction.AlphaFormat & ~AC_SRC_ALPHA) != 0)
+    {
+        DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendObj->BlendFunction.AlphaFormat);
+        return FALSE;
+    }
+
+    /* Check if there is anything to draw */
+    if (ClipRegion != NULL &&
+            (ClipRegion->rclBounds.left >= ClipRegion->rclBounds.right ||
+             ClipRegion->rclBounds.top >= ClipRegion->rclBounds.bottom))
+    {
+        /* Nothing to do */
+        return TRUE;
+    }
+
+    /* Stretch source if needed */
+    if (DestRect->right - DestRect->left != SourceRect->right - SourceRect->left ||
+            DestRect->bottom - DestRect->top != SourceRect->bottom - SourceRect->top)
+    {
+        SourceStretchedSize.cx = DestRect->right - DestRect->left;
+        SourceStretchedSize.cy = DestRect->bottom - DestRect->top;
+        Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(Source->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, Source->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, Source, NULL, NULL,
+                              NULL, &SourceStretchedRect, SourceRect, NULL,
+                              NULL, NULL, COLORONCOLOR))*/
+        if (!EngStretchBlt(SourceStretchedObj, Source, NULL, NULL, NULL,
+                           NULL, NULL, &SourceStretchedRect, SourceRect,
+                           NULL, COLORONCOLOR))
+        {
+            DPRINT1("EngStretchBlt failed!\n");
+            EngFreeMem(SourceStretchedObj->pvBits);
+            EngUnlockSurface(SourceStretchedObj);
+            EngDeleteSurface((HSURF)SourceStretchedBitmap);
+            return FALSE;
+        }
+        SourceRect = &SourceStretchedRect;
+        Source = SourceStretchedObj;
+    }
+
+    /* Now call the DIB function */
+    InputRect.left = SourceRect->left;
+    InputRect.right = SourceRect->right;
+    InputRect.top = SourceRect->top;
+    InputRect.bottom = SourceRect->bottom;
+    if (!IntEngEnter(&EnterLeaveSource, Source, &InputRect, TRUE, &Translate, &InputObj))
+    {
+        if (SourceStretchedObj != NULL)
+        {
+            EngFreeMem(SourceStretchedObj->pvBits);
+            EngUnlockSurface(SourceStretchedObj);
+        }
+        if (SourceStretchedBitmap != 0)
+        {
+            EngDeleteSurface((HSURF)SourceStretchedBitmap);
+        }
+        return FALSE;
+    }
+    InputRect.left = SourceRect->left + Translate.x;
+    InputRect.right = SourceRect->right + Translate.x;
+    InputRect.top = SourceRect->top + Translate.y;
+    InputRect.bottom = SourceRect->bottom + Translate.y;
+
+    OutputRect.left = DestRect->left;
+    OutputRect.right = DestRect->right;
+    OutputRect.top = DestRect->top;
+    OutputRect.bottom = DestRect->bottom;
+    if (!IntEngEnter(&EnterLeaveDest, Dest, &OutputRect, FALSE, &Translate, &OutputObj))
+    {
+        IntEngLeave(&EnterLeaveSource);
+        if (SourceStretchedObj != NULL)
+        {
+            EngFreeMem(SourceStretchedObj->pvBits);
+            EngUnlockSurface(SourceStretchedObj);
+        }
+        if (SourceStretchedBitmap != 0)
+        {
+            EngDeleteSurface((HSURF)SourceStretchedBitmap);
+        }
+        return FALSE;
+    }
+    OutputRect.left = DestRect->left + Translate.x;
+    OutputRect.right = DestRect->right + Translate.x;
+    OutputRect.top = DestRect->top + Translate.y;
+    OutputRect.bottom = DestRect->bottom + Translate.y;
+
+    Ret = FALSE;
+    ClippingType = (ClipRegion == NULL) ? DC_TRIVIAL : ClipRegion->iDComplexity;
+    switch (ClippingType)
+    {
+        case DC_TRIVIAL:
+            Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
+                      OutputObj, InputObj, &OutputRect, &InputRect, ClipRegion, ColorTranslation, BlendObj);
+            break;
+
+        case DC_RECT:
+            ClipRect.left = ClipRegion->rclBounds.left + Translate.x;
+            ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
+            ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
+            ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
+            if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
             {
-              ClipRect.left = RectEnum.arcl[i].left + Translate.x;
-              ClipRect.right = RectEnum.arcl[i].right + Translate.x;
-              ClipRect.top = RectEnum.arcl[i].top + Translate.y;
-              ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
-              if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+                Rect.left = InputRect.left + CombinedRect.left - OutputRect.left;
+                Rect.right = InputRect.right + CombinedRect.right - OutputRect.right;
+                Rect.top = InputRect.top + CombinedRect.top - OutputRect.top;
+                Rect.bottom = InputRect.bottom + CombinedRect.bottom - OutputRect.bottom;
+                Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
+                          OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj);
+            }
+            break;
+
+        case DC_COMPLEX:
+            Ret = TRUE;
+            CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0);
+            do
+            {
+                EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum),
+                                         (PVOID) &RectEnum);
+
+                for (i = 0; i < RectEnum.c; i++)
                 {
-                  Rect.left = InputRect.left + CombinedRect.left - OutputRect.left;
-                  Rect.right = InputRect.right + CombinedRect.right - OutputRect.right;
-                  Rect.top = InputRect.top + CombinedRect.top - OutputRect.top;
-                  Rect.bottom = InputRect.bottom + CombinedRect.bottom - OutputRect.bottom;
-                  Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
-                            OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj) && Ret;
+                    ClipRect.left = RectEnum.arcl[i].left + Translate.x;
+                    ClipRect.right = RectEnum.arcl[i].right + Translate.x;
+                    ClipRect.top = RectEnum.arcl[i].top + Translate.y;
+                    ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
+                    if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+                    {
+                        Rect.left = InputRect.left + CombinedRect.left - OutputRect.left;
+                        Rect.right = InputRect.right + CombinedRect.right - OutputRect.right;
+                        Rect.top = InputRect.top + CombinedRect.top - OutputRect.top;
+                        Rect.bottom = InputRect.bottom + CombinedRect.bottom - OutputRect.bottom;
+                        Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend(
+                                  OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj) && Ret;
+                    }
                 }
             }
-        }
-      while(EnumMore);
-      break;
-
-    default:
-      UNIMPLEMENTED;
-      ASSERT(FALSE);
-      break;
-    }
-
-  IntEngLeave(&EnterLeaveDest);
-  IntEngLeave(&EnterLeaveSource);
-
-  if (SourceStretchedObj != NULL)
-    {
-      EngFreeMem(SourceStretchedObj->pvBits);
-      EngUnlockSurface(SourceStretchedObj);
-    }
-  if (SourceStretchedBitmap != 0)
-    {
-      EngDeleteSurface((HSURF)SourceStretchedBitmap);
-    }
-
-  return Ret;
+            while (EnumMore);
+            break;
+
+        default:
+            UNIMPLEMENTED;
+            ASSERT(FALSE);
+            break;
+    }
+
+    IntEngLeave(&EnterLeaveDest);
+    IntEngLeave(&EnterLeaveSource);
+
+    if (SourceStretchedObj != NULL)
+    {
+        EngFreeMem(SourceStretchedObj->pvBits);
+        EngUnlockSurface(SourceStretchedObj);
+    }
+    if (SourceStretchedBitmap != 0)
+    {
+        EngDeleteSurface((HSURF)SourceStretchedBitmap);
+    }
+
+    return Ret;
 }
 
 BOOL STDCALL
@@ -1152,60 +1152,60 @@
                  IN PRECTL SourceRect,
                  IN BLENDOBJ *BlendObj)
 {
-  BOOL ret = FALSE;
-  BITMAPOBJ *DestObj;
-  BITMAPOBJ *SourceObj;
-
-  ASSERT(Dest);
-  DestObj = CONTAINING_RECORD(Dest, BITMAPOBJ, SurfObj);
-  ASSERT(DestObj);
-
-  ASSERT(Source);
-  SourceObj = CONTAINING_RECORD(Source, BITMAPOBJ, SurfObj);
-  ASSERT(SourceObj);
-
-  ASSERT(DestRect);
-  ASSERT(SourceRect);
-
-  /* Check if there is anything to draw */
-  if (ClipRegion != NULL &&
-      (ClipRegion->rclBounds.left >= ClipRegion->rclBounds.right ||
-       ClipRegion->rclBounds.top >= ClipRegion->rclBounds.bottom))
-    {
-      /* Nothing to do */
-      return TRUE;
-    }
-
-  BITMAPOBJ_LockBitmapBits(DestObj);
-  MouseSafetyOnDrawStart(Dest, DestRect->left, DestRect->top,
-                         DestRect->right, DestRect->bottom);
-
-  if (Source != Dest)
-    BITMAPOBJ_LockBitmapBits(SourceObj);
-  MouseSafetyOnDrawStart(Source, SourceRect->left, SourceRect->top,
-                         SourceRect->right, SourceRect->bottom);
-
-  /* Call the driver's DrvAlphaBlend if available */
-  if (DestObj->flHooks & HOOK_ALPHABLEND)
-    {
-      ret = GDIDEVFUNCS(Dest).AlphaBlend(
-                        Dest, Source, ClipRegion, ColorTranslation,
-                        DestRect, SourceRect, BlendObj);
-    }
-
-  if (! ret)
-    {
-      ret = EngAlphaBlend(Dest, Source, ClipRegion, ColorTranslation,
-                          DestRect, SourceRect, BlendObj);
-    }
-
-  MouseSafetyOnDrawEnd(Source);
-  if (Source != Dest)
-    BITMAPOBJ_UnlockBitmapBits(SourceObj);
-  MouseSafetyOnDrawEnd(Dest);
-  BITMAPOBJ_UnlockBitmapBits(DestObj);
-
-  return ret;
+    BOOL ret = FALSE;
+    BITMAPOBJ *DestObj;
+    BITMAPOBJ *SourceObj;
+
+    ASSERT(Dest);
+    DestObj = CONTAINING_RECORD(Dest, BITMAPOBJ, SurfObj);
+    ASSERT(DestObj);
+
+    ASSERT(Source);
+    SourceObj = CONTAINING_RECORD(Source, BITMAPOBJ, SurfObj);
+    ASSERT(SourceObj);
+
+    ASSERT(DestRect);
+    ASSERT(SourceRect);
+
+    /* Check if there is anything to draw */
+    if (ClipRegion != NULL &&
+            (ClipRegion->rclBounds.left >= ClipRegion->rclBounds.right ||
+             ClipRegion->rclBounds.top >= ClipRegion->rclBounds.bottom))
+    {
+        /* Nothing to do */
+        return TRUE;
+    }
+
+    BITMAPOBJ_LockBitmapBits(DestObj);
+    MouseSafetyOnDrawStart(Dest, DestRect->left, DestRect->top,
+                           DestRect->right, DestRect->bottom);
+
+    if (Source != Dest)
+        BITMAPOBJ_LockBitmapBits(SourceObj);
+    MouseSafetyOnDrawStart(Source, SourceRect->left, SourceRect->top,
+                           SourceRect->right, SourceRect->bottom);
+
+    /* Call the driver's DrvAlphaBlend if available */
+    if (DestObj->flHooks & HOOK_ALPHABLEND)
+    {
+        ret = GDIDEVFUNCS(Dest).AlphaBlend(
+                  Dest, Source, ClipRegion, ColorTranslation,
+                  DestRect, SourceRect, BlendObj);
+    }
+
+    if (! ret)
+    {
+        ret = EngAlphaBlend(Dest, Source, ClipRegion, ColorTranslation,
+                            DestRect, SourceRect, BlendObj);
+    }
+
+    MouseSafetyOnDrawEnd(Source);
+    if (Source != Dest)
+        BITMAPOBJ_UnlockBitmapBits(SourceObj);
+    MouseSafetyOnDrawEnd(Dest);
+    BITMAPOBJ_UnlockBitmapBits(DestObj);
+
+    return ret;
 }
 
 /**** REACTOS FONT RENDERING CODE *********************************************/
@@ -1213,289 +1213,289 @@
 /* renders the alpha mask bitmap */
 static BOOLEAN STDCALL
 AlphaBltMask(SURFOBJ* Dest,
-	SURFOBJ* Source,
-	SURFOBJ* Mask,
-	XLATEOBJ* ColorTranslation,
-	XLATEOBJ* SrcColorTranslation,
-	RECTL* DestRect,
-	POINTL* SourcePoint,
-	POINTL* MaskPoint,
-	BRUSHOBJ* Brush,
-	POINTL* BrushPoint)
+             SURFOBJ* Source,
+             SURFOBJ* Mask,
+             XLATEOBJ* ColorTranslation,
+             XLATEOBJ* SrcColorTranslation,
+             RECTL* DestRect,
+             POINTL* SourcePoint,
+             POINTL* MaskPoint,
+             BRUSHOBJ* Brush,
+             POINTL* BrushPoint)
 {
-  LONG i, j, dx, dy;
-  int r, g, b;
-  ULONG Background, BrushColor, NewColor;
-  BYTE *tMask, *lMask;
-
-  dx = DestRect->right  - DestRect->left;
-  dy = DestRect->bottom - DestRect->top;
-
-  if (Mask != NULL)
-    {
-      BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, Brush->iSolidColor);
-      r = (int)GetRValue(BrushColor);
-      g = (int)GetGValue(BrushColor);
-      b = (int)GetBValue(BrushColor);
-
-      tMask = (PBYTE)Mask->pvScan0 + (SourcePoint->y * Mask->lDelta) + SourcePoint->x;
-      for (j = 0; j < dy; j++)
-        {
-          lMask = tMask;
-          for (i = 0; i < dx; i++)
+    LONG i, j, dx, dy;
+    int r, g, b;
+    ULONG Background, BrushColor, NewColor;
+    BYTE *tMask, *lMask;
+
+    dx = DestRect->right  - DestRect->left;
+    dy = DestRect->bottom - DestRect->top;
+
+    if (Mask != NULL)
+    {
+        BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, Brush->iSolidColor);
+        r = (int)GetRValue(BrushColor);
+        g = (int)GetGValue(BrushColor);
+        b = (int)GetBValue(BrushColor);
+
+        tMask = (PBYTE)Mask->pvScan0 + (SourcePoint->y * Mask->lDelta) + SourcePoint->x;
+        for (j = 0; j < dy; j++)
+        {
+            lMask = tMask;
+            for (i = 0; i < dx; i++)
             {
-              if (*lMask > 0)
+                if (*lMask > 0)
                 {
-                  if (*lMask == 0xff)
+                    if (*lMask == 0xff)
                     {
-                      DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
-                          Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
+                        DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
+                            Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
                     }
-                  else
+                    else
                     {
-                      Background = DIB_GetSource(Dest, DestRect->left + i, DestRect->top + j,
-                                                 SrcColorTranslation);
-
-                      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);
-                      DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
-                        Dest, DestRect->left + i, DestRect->top + j, Background);
+                        Background = DIB_GetSource(Dest, DestRect->left + i, DestRect->top + j,
+                                                   SrcColorTranslation);
+
+                        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);
+                        DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel(
+                            Dest, DestRect->left + i, DestRect->top + j, Background);
                     }
                 }
-              lMask++;
+                lMask++;
             }
-          tMask += Mask->lDelta;
-        }
-      return TRUE;
-    }
-  else
-    {
-      return FALSE;
+            tMask += Mask->lDelta;
+        }
+        return TRUE;
+    }
+    else
+    {
+        return FALSE;
     }
 }
 
 BOOL STDCALL
 EngMaskBitBlt(SURFOBJ *DestObj,
-	  SURFOBJ *Mask,
-	  CLIPOBJ *ClipRegion,
-	  XLATEOBJ *DestColorTranslation,
-	  XLATEOBJ *SourceColorTranslation,
-	  RECTL *DestRect,
-	  POINTL *SourcePoint,
-	  POINTL *MaskOrigin,
-	  BRUSHOBJ *Brush,
-	  POINTL *BrushOrigin)
+              SURFOBJ *Mask,
+              CLIPOBJ *ClipRegion,
+              XLATEOBJ *DestColorTranslation,
+              XLATEOBJ *SourceColorTranslation,
+              RECTL *DestRect,
+              POINTL *SourcePoint,
+              POINTL *MaskOrigin,
+              BRUSHOBJ *Brush,
+              POINTL *BrushOrigin)
 {
-  BYTE               clippingType;
-  RECTL              CombinedRect;
-  RECT_ENUM          RectEnum;
-  BOOL               EnumMore;
-  POINTL             InputPoint;
-  RECTL              InputRect;
-  RECTL              OutputRect;
-  POINTL             Translate;
-  INTENG_ENTER_LEAVE EnterLeaveSource;
-  INTENG_ENTER_LEAVE EnterLeaveDest;
-  SURFOBJ*           InputObj;
-  SURFOBJ*           OutputObj;
-  BOOLEAN            Ret = TRUE;
-  RECTL              ClipRect;
-  unsigned           i;
-  POINTL             Pt;
-  ULONG              Direction;
-  POINTL             AdjustedBrushOrigin;
-
-  ASSERT ( Mask );
-
-  if (NULL != SourcePoint)
-    {
-    InputRect.left = SourcePoint->x;
-    InputRect.right = SourcePoint->x + (DestRect->right - DestRect->left);
-    InputRect.top = SourcePoint->y;
-    InputRect.bottom = SourcePoint->y + (DestRect->bottom - DestRect->top);
-    }
-  else
-    {
-    InputRect.left = 0;
-    InputRect.right = DestRect->right - DestRect->left;
-    InputRect.top = 0;
-    InputRect.bottom = DestRect->bottom - DestRect->top;
-    }
-
-  if (! IntEngEnter(&EnterLeaveSource, DestObj, &InputRect, TRUE, &Translate, &InputObj))
-    {
-    return FALSE;
-    }
-
-  if (NULL != SourcePoint)
-    {
-    InputPoint.x = SourcePoint->x + Translate.x;
-    InputPoint.y = SourcePoint->y + Translate.y;
-    }
-  else
-    {
-    InputPoint.x = 0;
-    InputPoint.y = 0;
-    }
-
-  OutputRect = *DestRect;
-  if (NULL != ClipRegion)
-    {
-      if (OutputRect.left < ClipRegion->rclBounds.left)
-	{
-	  InputRect.left += ClipRegion->rclBounds.left - OutputRect.left;
-	  InputPoint.x += ClipRegion->rclBounds.left - OutputRect.left;
-	  OutputRect.left = ClipRegion->rclBounds.left;
-	}
-      if (ClipRegion->rclBounds.right < OutputRect.right)
-	{
-	  InputRect.right -=  OutputRect.right - ClipRegion->rclBounds.right;
-	  OutputRect.right = ClipRegion->rclBounds.right;
-	}
-      if (OutputRect.top < ClipRegion->rclBounds.top)
-	{
-	  InputRect.top += ClipRegion->rclBounds.top - OutputRect.top;
-	  InputPoint.y += ClipRegion->rclBounds.top - OutputRect.top;
-	  OutputRect.top = ClipRegion->rclBounds.top;
-	}
-      if (ClipRegion->rclBounds.bottom < OutputRect.bottom)
-	{
-	  InputRect.bottom -=  OutputRect.bottom - ClipRegion->rclBounds.bottom;
-	  OutputRect.bottom = ClipRegion->rclBounds.bottom;
-	}
-    }
-
-  /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
-     nothing to do */
-  if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
-    {
-    IntEngLeave(&EnterLeaveSource);
-    return TRUE;
-    }
-
-  if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
-    {
-    IntEngLeave(&EnterLeaveSource);
-    return FALSE;
-    }
-
-  OutputRect.left = DestRect->left + Translate.x;
-  OutputRect.right = DestRect->right + Translate.x;
-  OutputRect.top = DestRect->top + Translate.y;
-  OutputRect.bottom = DestRect->bottom + Translate.y;
-
-  if(BrushOrigin)
-  {
-    AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
-    AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
-  }
-  else
-    AdjustedBrushOrigin = Translate;
-
-  // Determine clipping type
-  if (ClipRegion == (CLIPOBJ *) NULL)
-  {
-    clippingType = DC_TRIVIAL;
-  } else {
-    clippingType = ClipRegion->iDComplexity;
-  }
-
-  switch(clippingType)
-  {
-    case DC_TRIVIAL:
-      if(Mask->iBitmapFormat == BMF_8BPP)
-        Ret = AlphaBltMask(OutputObj, InputObj, Mask, DestColorTranslation, SourceColorTranslation,
-                           &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin);
-      else
-        Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation,
-                           &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin,
-                           R4_MASK);
-      break;
-    case DC_RECT:
-      // 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;
-      ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
-      if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
-        {
-          Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
-          Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
-          if(Mask->iBitmapFormat == BMF_8BPP)
+    BYTE               clippingType;
+    RECTL              CombinedRect;
+    RECT_ENUM          RectEnum;
+    BOOL               EnumMore;
+    POINTL             InputPoint;
+    RECTL              InputRect;
+    RECTL              OutputRect;
+    POINTL             Translate;
+    INTENG_ENTER_LEAVE EnterLeaveSource;
+    INTENG_ENTER_LEAVE EnterLeaveDest;
+    SURFOBJ*           InputObj;
+    SURFOBJ*           OutputObj;
+    BOOLEAN            Ret = TRUE;
+    RECTL              ClipRect;
+    unsigned           i;
+    POINTL             Pt;
+    ULONG              Direction;
+    POINTL             AdjustedBrushOrigin;
+
+    ASSERT ( Mask );
+
+    if (NULL != SourcePoint)
+    {
+        InputRect.left = SourcePoint->x;
+        InputRect.right = SourcePoint->x + (DestRect->right - DestRect->left);
+        InputRect.top = SourcePoint->y;
+        InputRect.bottom = SourcePoint->y + (DestRect->bottom - DestRect->top);
+    }
+    else
+    {
+        InputRect.left = 0;
+        InputRect.right = DestRect->right - DestRect->left;
+        InputRect.top = 0;
+        InputRect.bottom = DestRect->bottom - DestRect->top;
+    }
+
+    if (! IntEngEnter(&EnterLeaveSource, DestObj, &InputRect, TRUE, &Translate, &InputObj))
+    {
+        return FALSE;
+    }
+
+    if (NULL != SourcePoint)
+    {
+        InputPoint.x = SourcePoint->x + Translate.x;
+        InputPoint.y = SourcePoint->y + Translate.y;
+    }
+    else
+    {
+        InputPoint.x = 0;
+        InputPoint.y = 0;
+    }
+
+    OutputRect = *DestRect;
+    if (NULL != ClipRegion)
+    {
+        if (OutputRect.left < ClipRegion->rclBounds.left)
+        {
+            InputRect.left += ClipRegion->rclBounds.left - OutputRect.left;
+            InputPoint.x += ClipRegion->rclBounds.left - OutputRect.left;
+            OutputRect.left = ClipRegion->rclBounds.left;
+        }
+        if (ClipRegion->rclBounds.right < OutputRect.right)
+        {
+            InputRect.right -=  OutputRect.right - ClipRegion->rclBounds.right;
+            OutputRect.right = ClipRegion->rclBounds.right;
+        }
+        if (OutputRect.top < ClipRegion->rclBounds.top)
+        {
+            InputRect.top += ClipRegion->rclBounds.top - OutputRect.top;
+            InputPoint.y += ClipRegion->rclBounds.top - OutputRect.top;
+            OutputRect.top = ClipRegion->rclBounds.top;
+        }
+        if (ClipRegion->rclBounds.bottom < OutputRect.bottom)
+        {
+            InputRect.bottom -=  OutputRect.bottom - ClipRegion->rclBounds.bottom;
+            OutputRect.bottom = ClipRegion->rclBounds.bottom;
+        }
+    }
+
+    /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
+       nothing to do */
+    if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
+    {
+        IntEngLeave(&EnterLeaveSource);
+        return TRUE;
+    }
+
+    if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
+    {
+        IntEngLeave(&EnterLeaveSource);
+        return FALSE;
+    }
+
+    OutputRect.left = DestRect->left + Translate.x;
+    OutputRect.right = DestRect->right + Translate.x;
+    OutputRect.top = DestRect->top + Translate.y;
+    OutputRect.bottom = DestRect->bottom + Translate.y;
+
+    if (BrushOrigin)
+    {
+        AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
+        AdjustedBrushOrigin.y = BrushOrigin->y + Translate.y;
+    }
+    else
+        AdjustedBrushOrigin = Translate;
+
+    // Determine clipping type
+    if (ClipRegion == (CLIPOBJ *) NULL)
+    {
+        clippingType = DC_TRIVIAL;
+    } else {
+        clippingType = ClipRegion->iDComplexity;
+    }
+
+    switch (clippingType)
+    {
+        case DC_TRIVIAL:
+            if (Mask->iBitmapFormat == BMF_8BPP)
+                Ret = AlphaBltMask(OutputObj, InputObj, Mask, DestColorTranslation, SourceColorTranslation,
+                                   &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin);
+            else
+                Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation,
+                              &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin,
+                              R4_MASK);
+            break;
+        case DC_RECT:
+            // 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;
+            ClipRect.bottom = ClipRegion->rclBounds.bottom + Translate.y;
+            if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
             {
-              Ret = AlphaBltMask(OutputObj, InputObj, Mask, DestColorTranslation, SourceColorTranslation,
-                                 &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin);
+                Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
+                Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
+                if (Mask->iBitmapFormat == BMF_8BPP)
+                {
+                    Ret = AlphaBltMask(OutputObj, InputObj, Mask, DestColorTranslation, SourceColorTranslation,
+                                       &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin);
+                }
+                else
+                {
+                    Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation,
+                                  &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, R4_MASK);
+                }
             }
-          else
+            break;
+        case DC_COMPLEX:
+            Ret = TRUE;
+            if (OutputObj == InputObj)
             {
-              Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation,
-                            &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, R4_MASK);
+                if (OutputRect.top < InputPoint.y)
+                {
+                    Direction = OutputRect.left < InputPoint.x ? CD_RIGHTDOWN : CD_LEFTDOWN;
+                }
+                else
+                {
+                    Direction = OutputRect.left < InputPoint.x ? CD_RIGHTUP : CD_LEFTUP;
+                }
             }
-        }
-      break;
-    case DC_COMPLEX:
-      Ret = TRUE;
-      if (OutputObj == InputObj)
-	{
-	  if (OutputRect.top < InputPoint.y)
-	    {
-	      Direction = OutputRect.left < InputPoint.x ? CD_RIGHTDOWN : CD_LEFTDOWN;
-	    }
-	  else
-	    {
-	      Direction = OutputRect.left < InputPoint.x ? CD_RIGHTUP : CD_LEFTUP;
-	    }
-	}
-      else
-	{
-	  Direction = CD_ANY;
-	}
-      CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, Direction, 0);
-      do
-	{
-	  EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
-
-	  for (i = 0; i < RectEnum.c; i++)
-	    {
-	      ClipRect.left = RectEnum.arcl[i].left + Translate.x;
-	      ClipRect.right = RectEnum.arcl[i].right + Translate.x;
-	      ClipRect.top = RectEnum.arcl[i].top + Translate.y;
-	      ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
-	      if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+            else
+            {
+                Direction = CD_ANY;
+            }
+            CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, Direction, 0);
+            do
+            {
+                EnumMore = CLIPOBJ_bEnum(ClipRegion,(ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
+
+                for (i = 0; i < RectEnum.c; i++)
                 {
-                  Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
-                  Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
-                  if(Mask->iBitmapFormat == BMF_8BPP)
+                    ClipRect.left = RectEnum.arcl[i].left + Translate.x;
+                    ClipRect.right = RectEnum.arcl[i].right + Translate.x;
+                    ClipRect.top = RectEnum.arcl[i].top + Translate.y;
+                    ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
+                    if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
                     {
-                      Ret = AlphaBltMask(OutputObj, InputObj, Mask,
-                                         DestColorTranslation,
-                                         SourceColorTranslation,
-                                         &CombinedRect, &Pt, MaskOrigin, Brush,
-                                         &AdjustedBrushOrigin) && Ret;
-                    }
-                  else
-                    {
-                      Ret = BltMask(OutputObj, InputObj, Mask,
-                                    DestColorTranslation, &CombinedRect, &Pt,
-                                    MaskOrigin, Brush, &AdjustedBrushOrigin,
-                                    R4_MASK) && Ret;
+                        Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
+                        Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
+                        if (Mask->iBitmapFormat == BMF_8BPP)
+                        {
+                            Ret = AlphaBltMask(OutputObj, InputObj, Mask,
+                                               DestColorTranslation,
+                                               SourceColorTranslation,
+                                               &CombinedRect, &Pt, MaskOrigin, Brush,
+                                               &AdjustedBrushOrigin) && Ret;
+                        }
+                        else
+                        {
+                            Ret = BltMask(OutputObj, InputObj, Mask,
+                                          DestColorTranslation, &CombinedRect, &Pt,
+                                          MaskOrigin, Brush, &AdjustedBrushOrigin,
+                                          R4_MASK) && Ret;
+                        }
                     }
                 }
-	    }
-	}
-      while(EnumMore);
-      break;
-  }
-
-
-  IntEngLeave(&EnterLeaveDest);
-  IntEngLeave(&EnterLeaveSource);
-
-  return Ret;
+            }
+            while (EnumMore);
+            break;
+    }
+
+
+    IntEngLeave(&EnterLeaveDest);
+    IntEngLeave(&EnterLeaveSource);
+
+    return Ret;
 }
 
 BOOL STDCALL
@@ -1510,61 +1510,61 @@
               BRUSHOBJ *Brush,
               POINTL *BrushOrigin)
 {
-  BOOLEAN ret;
-  RECTL OutputRect;
-  POINTL InputPoint;
-  BITMAPOBJ *DestObj;
-
-  ASSERT(Mask);
-
-  if (NULL != SourcePoint)
-    {
-      InputPoint = *SourcePoint;
-    }
-
-  /* Clip against the bounds of the clipping region so we won't try to write
-   * outside the surface */
-  if (NULL != ClipRegion)
-    {
-      if (! EngIntersectRect(&OutputRect, DestRect, &ClipRegion->rclBounds))
-	{
-	  return TRUE;
-	}
-      InputPoint.x += OutputRect.left - DestRect->left;
-      InputPoint.y += OutputRect.top - DestRect->top;
-    }
-  else
-    {
-      OutputRect = *DestRect;
-    }
-
-  /* No success yet */
-  ret = FALSE;
-  ASSERT(DestSurf);
-  DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
-
-  BITMAPOBJ_LockBitmapBits(DestObj);
-  MouseSafetyOnDrawStart(DestSurf, OutputRect.left, OutputRect.top,
-                         OutputRect.right, OutputRect.bottom);
-
-  /* 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(DestSurf, NULL, Mask, ClipRegion, DestColorTranslation,
-                 DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin,
-                 R4_NOOP, FALSE);
-
-  ret = EngMaskBitBlt(DestSurf, Mask, ClipRegion, DestColorTranslation, SourceColorTranslation,
-                      &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin);
-
-  /* Dummy BitBlt to let driver know that something has changed. */
-  IntEngBitBltEx(DestSurf, NULL, Mask, ClipRegion, DestColorTranslation,
-                 DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin,
-                 R4_NOOP, FALSE);
-
-  MouseSafetyOnDrawEnd(DestSurf);
-  BITMAPOBJ_UnlockBitmapBits(DestObj);
-
-  return ret;
+    BOOLEAN ret;
+    RECTL OutputRect;
+    POINTL InputPoint;
+    BITMAPOBJ *DestObj;
+
+    ASSERT(Mask);
+
+    if (NULL != SourcePoint)
+    {
+        InputPoint = *SourcePoint;
+    }
+
+    /* Clip against the bounds of the clipping region so we won't try to write
+     * outside the surface */
+    if (NULL != ClipRegion)
+    {
+        if (! EngIntersectRect(&OutputRect, DestRect, &ClipRegion->rclBounds))
+        {
+            return TRUE;
+        }
+        InputPoint.x += OutputRect.left - DestRect->left;
+        InputPoint.y += OutputRect.top - DestRect->top;
+    }
+    else
+    {
+        OutputRect = *DestRect;
+    }
+
+    /* No success yet */
+    ret = FALSE;
+    ASSERT(DestSurf);
+    DestObj = CONTAINING_RECORD(DestSurf, BITMAPOBJ, SurfObj);
+
+    BITMAPOBJ_LockBitmapBits(DestObj);
+    MouseSafetyOnDrawStart(DestSurf, OutputRect.left, OutputRect.top,
+                           OutputRect.right, OutputRect.bottom);
+
+    /* 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(DestSurf, NULL, Mask, ClipRegion, DestColorTranslation,
+                   DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin,
+                   R4_NOOP, FALSE);
+
+    ret = EngMaskBitBlt(DestSurf, Mask, ClipRegion, DestColorTranslation, SourceColorTranslation,
+                        &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin);
+
+    /* Dummy BitBlt to let driver know that something has changed. */
+    IntEngBitBltEx(DestSurf, NULL, Mask, ClipRegion, DestColorTranslation,
+                   DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin,
+                   R4_NOOP, FALSE);
+
+    MouseSafetyOnDrawEnd(DestSurf);
+    BITMAPOBJ_UnlockBitmapBits(DestObj);
+
+    return ret;
 }
 /* EOF */




More information about the Ros-diffs mailing list