Author: gschneider
Date: Sun Feb 8 14:28:20 2009
New Revision: 39501
URL:
http://svn.reactos.org/svn/reactos?rev=39501&view=rev
Log:
Preparation for StretchBlt pattern support:
- Supply BrushObj and BrushOrigin to IntStretchBlt
- Implement EngStretchBltROP to do the work, let EngStretchBlt call it (this allows ROP
support for real now)
Modified:
trunk/reactos/subsystems/win32/win32k/eng/bitblt.c
trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Sun Feb 8 14:28:20
2009
@@ -771,8 +771,7 @@
IN RECTL *prclDest,
IN RECTL *prclSrc,
IN POINTL *MaskOrigin,
- IN ULONG Mode
-)
+ IN ULONG Mode)
{
COLORADJUSTMENT ca;
POINTL lBrushOrigin;
@@ -807,6 +806,179 @@
return EngStretchBlt(psoDest, psoSource, Mask, ClipRegion, ColorTranslation, &ca,
&lBrushOrigin, &rclDest, &rclSrc, &lMaskOrigin, Mode);
}
+/*
+ * @implemented
+ */
+BOOL
+APIENTRY
+EngStretchBltROP(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSource,
+ 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 BRUSHOBJ *Brush,
+ IN DWORD ROP4)
+{
+ RECTL InputRect;
+ RECTL OutputRect;
+ POINTL Translate;
+ INTENG_ENTER_LEAVE EnterLeaveSource;
+ INTENG_ENTER_LEAVE EnterLeaveDest;
+ SURFOBJ* psoInput;
+ SURFOBJ* psoOutput;
+ PSTRETCHRECTFUNC BltRectFunc;
+ BOOLEAN Ret;
+ POINTL AdjustedBrushOrigin;
+ BOOL UsesSource = ROP4_USES_SOURCE(ROP4);
+
+ if (ROP4 == R4_NOOP)
+ {
+ /* Copy destination onto itself: nop */
+ return TRUE;
+ }
+
+ OutputRect = *prclDest;
+ if (OutputRect.right < OutputRect.left)
+ {
+ OutputRect.left = prclDest->right;
+ OutputRect.right = prclDest->left;
+ }
+ if (OutputRect.bottom < OutputRect.top)
+ {
+ OutputRect.left = prclDest->right;
+ OutputRect.right = prclDest->left;
+ }
+
+ InputRect = *prclSrc;
+ if (UsesSource)
+ {
+ if (NULL == prclSrc)
+ {
+ return FALSE;
+ }
+
+ /* Make sure we don't try to copy anything outside the valid source region
*/
+ if (InputRect.left < 0)
+ {
+ OutputRect.left -= InputRect.left;
+ InputRect.left = 0;
+ }
+ if (InputRect.top < 0)
+ {
+ OutputRect.top -= InputRect.top;
+ InputRect.top = 0;
+ }
+
+ if (! IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE,
+ &Translate, &psoInput))
+ {
+ return FALSE;
+ }
+
+ InputRect.left += Translate.x;
+ InputRect.right += Translate.x;
+ InputRect.top += Translate.y;
+ InputRect.bottom += Translate.y;
+ }
+
+ if (NULL != ClipRegion)
+ {
+ if (OutputRect.left < ClipRegion->rclBounds.left)
+ {
+ InputRect.left += 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;
+ 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, psoDest, &OutputRect, FALSE,
&Translate, &psoOutput))
+ {
+ 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;
+ }
+
+ if (Mask != NULL)
+ {
+ //BltRectFunc = BltMask;
+ DPRINT("EngStretchBlt isn't capable of handling mask yet.\n");
+ IntEngLeave(&EnterLeaveDest);
+ if (UsesSource)
+ {
+ IntEngLeave(&EnterLeaveSource);
+ }
+ return FALSE;
+ }
+ else
+ {
+ BltRectFunc = CallDibStretchBlt;
+ }
+
+ Ret = (*BltRectFunc)(psoOutput, psoInput, Mask, ClipRegion,
+ ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
+ &AdjustedBrushOrigin, ROP4);
+
+ IntEngLeave(&EnterLeaveDest);
+ if (UsesSource)
+ {
+ IntEngLeave(&EnterLeaveSource);
+ }
+
+ return Ret;
+}
+
+/*
+ * @implemented
+ */
BOOL
APIENTRY
EngStretchBlt(
@@ -820,159 +992,22 @@
IN RECTL *prclDest,
IN RECTL *prclSrc,
IN POINTL *MaskOrigin,
- IN ULONG Mode
-)
+ IN ULONG Mode)
{
- //
www.osr.com/ddk/graphics/gdifncs_0bs7.htm
-
- RECTL InputRect;
- RECTL OutputRect;
- POINTL Translate;
- INTENG_ENTER_LEAVE EnterLeaveSource;
- INTENG_ENTER_LEAVE EnterLeaveDest;
- SURFOBJ* psoInput;
- SURFOBJ* psoOutput;
- PSTRETCHRECTFUNC BltRectFunc;
- BOOLEAN Ret;
- POINTL AdjustedBrushOrigin;
- BOOL UsesSource = ROP4_USES_SOURCE(Mode);
-
- if (Mode == R4_NOOP)
- {
- /* Copy destination onto itself: nop */
- return TRUE;
- }
-
- OutputRect = *prclDest;
- if (OutputRect.right < OutputRect.left)
- {
- OutputRect.left = prclDest->right;
- OutputRect.right = prclDest->left;
- }
- if (OutputRect.bottom < OutputRect.top)
- {
- OutputRect.left = prclDest->right;
- OutputRect.right = prclDest->left;
- }
-
- InputRect = *prclSrc;
- if (UsesSource)
- {
- if (NULL == prclSrc)
- {
- return FALSE;
- }
-
- /* Make sure we don't try to copy anything outside the valid source region
*/
- if (InputRect.left < 0)
- {
- OutputRect.left -= InputRect.left;
- InputRect.left = 0;
- }
- if (InputRect.top < 0)
- {
- OutputRect.top -= InputRect.top;
- InputRect.top = 0;
- }
-
- if (! IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE,
- &Translate, &psoInput))
- {
- return FALSE;
- }
-
- InputRect.left += Translate.x;
- InputRect.right += Translate.x;
- InputRect.top += Translate.y;
- InputRect.bottom += Translate.y;
- }
-
- if (NULL != ClipRegion)
- {
- if (OutputRect.left < ClipRegion->rclBounds.left)
- {
- InputRect.left += 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;
- 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, psoDest, &OutputRect, FALSE,
&Translate, &psoOutput))
- {
- 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;
- }
-
- if (Mask != NULL)
- {
- //BltRectFunc = BltMask;
- DPRINT("EngStretchBlt isn't capable of handling mask yet.\n");
- IntEngLeave(&EnterLeaveDest);
- if (UsesSource)
- {
- IntEngLeave(&EnterLeaveSource);
- }
- return FALSE;
- }
- else
- {
- BltRectFunc = CallDibStretchBlt;
- }
-
- Ret = (*BltRectFunc)(psoOutput, psoInput, Mask, ClipRegion,
- ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
- &AdjustedBrushOrigin, Mode);
-
- IntEngLeave(&EnterLeaveDest);
- if (UsesSource)
- {
- IntEngLeave(&EnterLeaveSource);
- }
-
- return Ret;
+ return EngStretchBltROP(
+ psoDest,
+ psoSource,
+ Mask,
+ ClipRegion,
+ ColorTranslation,
+ pca,
+ BrushOrigin,
+ prclDest,
+ prclSrc,
+ MaskOrigin,
+ Mode,
+ NULL,
+ SRCCOPY);
}
BOOL APIENTRY
@@ -1104,8 +1139,8 @@
if (! ret)
{
// FIXME: see previous fixme
- ret = EngStretchBlt(psoDest, psoSource, MaskSurf, ClipRegion, ColorTranslation,
- &ca, BrushOrigin, &OutputRect, &InputRect, NULL,
ROP);
+ ret = EngStretchBltROP(psoDest, psoSource, MaskSurf, ClipRegion,
ColorTranslation,
+ &ca, BrushOrigin, &OutputRect, &InputRect, NULL,
COLORONCOLOR, Brush, ROP);
}
if (UsesSource)
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Sun Feb 8
14:28:20 2009
@@ -756,7 +756,9 @@
RECTL SourceRect;
BOOL Status = FALSE;
XLATEOBJ *XlateObj = NULL;
+ POINTL BrushOrigin;
PGDIBRUSHOBJ BrushObj = NULL;
+ GDIBRUSHINST BrushInst;
BOOL UsesSource = ROP3_USES_SOURCE(ROP);
BOOL UsesPattern = ROP3_USES_PATTERN(ROP);
@@ -835,6 +837,9 @@
IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2);
}
+ BrushOrigin.x = 0;
+ BrushOrigin.y = 0;
+
/* Determine surfaces to be used in the bitblt */
BitmapDest = SURFACE_LockSurface(DCDest->w.hBitmap);
if (BitmapDest == NULL)
@@ -920,13 +925,16 @@
SetLastWin32Error(ERROR_INVALID_HANDLE);
goto failed;
}
+ BrushOrigin = *((PPOINTL)&BrushObj->ptOrigin);
+ IntGdiInitBrushInstance(&BrushInst, BrushObj, DCDest->XlateBrush);
}
/* Perform the bitblt operation */
Status = IntEngStretchBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj,
NULL, DCDest->CombinedClip, XlateObj,
- &DestRect, &SourceRect, NULL, NULL, NULL,
- ROP3_TO_ROP4(ROP));
+ &DestRect, &SourceRect, NULL,
+ BrushObj ? &BrushInst.BrushObject : NULL,
+ &BrushOrigin, ROP3_TO_ROP4(ROP));
failed:
if (XlateObj)
Modified: trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/st…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] Sun Feb 8 14:28:20
2009
@@ -938,26 +938,6 @@
UNIMPLEMENTED;
return 0;
}
-BOOL APIENTRY
-EngStretchBltROP(
- IN SURFOBJ *Dest,
- IN SURFOBJ *Source,
- IN SURFOBJ *Mask,
- IN CLIPOBJ *Clip,
- IN XLATEOBJ *Xlate,
- IN COLORADJUSTMENT *ColorAdjustment,
- IN POINTL *BrushOrigin,
- IN RECTL *DestRect,
- IN RECTL *SourceRect,
- IN POINTL *MaskPoint,
- IN ULONG Mode,
- IN BRUSHOBJ *BrushObj,
- IN DWORD ROP4)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
/*
* @unimplemented