-/*
+/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: GDI alpha blending functions
IN PRECTL SourceRect,
IN BLENDOBJ *BlendObj)
{
- RECTL SourceStretchedRect;
- SIZEL SourceStretchedSize;
- HBITMAP SourceStretchedBitmap = 0;
- SURFOBJ* SourceStretchedObj = NULL;
RECTL InputRect;
RECTL OutputRect;
RECTL ClipRect;
INTENG_ENTER_LEAVE EnterLeaveDest;
SURFOBJ* InputObj;
SURFOBJ* OutputObj;
- LONG Width;
LONG ClippingType;
RECT_ENUM RectEnum;
BOOL EnumMore;
InputRect = *SourceRect;
if ( (InputRect.top < 0) || (InputRect.bottom < 0) ||
(InputRect.left < 0) || (InputRect.right < 0) ||
- InputRect.right > psoSource->sizlBitmap.cx ||
+ InputRect.right > psoSource->sizlBitmap.cx ||
InputRect.bottom > psoSource->sizlBitmap.cy )
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return TRUE;
}
- /* Stretch source if needed */
- if (OutputRect.right - OutputRect.left != InputRect.right - InputRect.left ||
- OutputRect.bottom - OutputRect.top != InputRect.bottom - InputRect.top)
- {
- SourceStretchedSize.cx = OutputRect.right - OutputRect.left;
- SourceStretchedSize.cy = OutputRect.bottom - OutputRect.top;
- Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(psoSource->iBitmapFormat));
- /* FIXME: Maybe it is a good idea to use EngCreateDeviceBitmap and IntEngStretchBlt
- if possible to get a HW accelerated stretch. */
- SourceStretchedBitmap = EngCreateBitmap(SourceStretchedSize, Width, psoSource->iBitmapFormat,
- BMF_TOPDOWN | BMF_NOZEROINIT, NULL);
- if (SourceStretchedBitmap == 0)
- {
- DPRINT1("EngCreateBitmap failed!\n");
- return FALSE;
- }
- SourceStretchedObj = EngLockSurface((HSURF)SourceStretchedBitmap);
- if (SourceStretchedObj == NULL)
- {
- DPRINT1("EngLockSurface failed!\n");
- EngDeleteSurface((HSURF)SourceStretchedBitmap);
- return FALSE;
- }
-
- SourceStretchedRect.left = 0;
- SourceStretchedRect.right = SourceStretchedSize.cx;
- SourceStretchedRect.top = 0;
- SourceStretchedRect.bottom = SourceStretchedSize.cy;
- /* FIXME: IntEngStretchBlt isn't used here atm because it results in a
- try to acquire an already acquired mutex (lock the already locked source surface) */
- /*if (!IntEngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL,
- NULL, &SourceStretchedRect, SourceRect, NULL,
- NULL, NULL, COLORONCOLOR))*/
- if (!EngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL, NULL,
- NULL, NULL, &SourceStretchedRect, &InputRect,
- NULL, COLORONCOLOR))
- {
- DPRINT1("EngStretchBlt failed!\n");
- EngFreeMem(SourceStretchedObj->pvBits);
- EngUnlockSurface(SourceStretchedObj);
- EngDeleteSurface((HSURF)SourceStretchedBitmap);
- return FALSE;
- }
- InputRect.top = SourceStretchedRect.top;
- InputRect.bottom = SourceStretchedRect.bottom;
- InputRect.left = SourceStretchedRect.left;
- InputRect.right = SourceStretchedRect.right;
- psoSource = SourceStretchedObj;
- }
-
/* Now call the DIB function */
if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
{
- if (SourceStretchedObj != NULL)
- {
- EngFreeMem(SourceStretchedObj->pvBits);
- EngUnlockSurface(SourceStretchedObj);
- }
- if (SourceStretchedBitmap != 0)
- {
- EngDeleteSurface((HSURF)SourceStretchedBitmap);
- }
return FALSE;
}
InputRect.left += Translate.x;
if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
{
- IntEngLeave(&EnterLeaveSource);
- if (SourceStretchedObj != NULL)
- {
- EngFreeMem(SourceStretchedObj->pvBits);
- EngUnlockSurface(SourceStretchedObj);
- }
- if (SourceStretchedBitmap != 0)
- {
- EngDeleteSurface((HSURF)SourceStretchedBitmap);
- }
return FALSE;
}
OutputRect.left += Translate.x;
IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource);
- if (SourceStretchedObj != NULL)
- {
- EngFreeMem(SourceStretchedObj->pvBits);
- EngUnlockSurface(SourceStretchedObj);
- }
- if (SourceStretchedBitmap != 0)
- {
- EngDeleteSurface((HSURF)SourceStretchedBitmap);
- }
-
return Ret;
}
return TRUE;
}
- SURFACE_LockBitmapBits(psurfDest);
- MouseSafetyOnDrawStart(psoDest, DestRect->left, DestRect->top,
- DestRect->right, DestRect->bottom);
-
- if (psoSource != psoDest)
- SURFACE_LockBitmapBits(psurfSource);
- MouseSafetyOnDrawStart(psoSource, SourceRect->left, SourceRect->top,
- SourceRect->right, SourceRect->bottom);
-
/* Call the driver's DrvAlphaBlend if available */
- if (psurfDest->flHooks & HOOK_ALPHABLEND)
+ if (psurfDest->flags & HOOK_ALPHABLEND)
{
ret = GDIDEVFUNCS(psoDest).AlphaBlend(
psoDest, psoSource, ClipRegion, ColorTranslation,
DestRect, SourceRect, BlendObj);
}
- MouseSafetyOnDrawEnd(psoSource);
- if (psoSource != psoDest)
- SURFACE_UnlockBitmapBits(psurfSource);
- MouseSafetyOnDrawEnd(psoDest);
- SURFACE_UnlockBitmapBits(psurfDest);
-
return ret;
}