EngMaskBitBlt and IntEngMaskBlt do not have a source surface, so it makes no sense to have a source point. Remove it from the prototype. (Aplpha)BltMask need to have a spacial prototype including a source surface and point, but they are unused, use the mask point instead of the source point. IntEngMaskBitBlt: call IntEngEnter with the mask surface, instead of 2 times with the dest surface, intersect with Clip bounding rect before. Fixes wrong text origin/crippled text when outputting clipped text.

svn path=/trunk/; revision=40449
This commit is contained in:
Timo Kreuzer 2009-04-10 20:50:57 +00:00
parent ed40a59c44
commit 4b6b9a55ca
3 changed files with 66 additions and 79 deletions

View file

@ -78,14 +78,14 @@ BOOL APIENTRY EngIntersectRect(RECTL* prcDst, RECTL* prcSrc1, RECTL* prcSrc2)
static BOOLEAN APIENTRY static BOOLEAN APIENTRY
BltMask(SURFOBJ* psoDest, BltMask(SURFOBJ* psoDest,
SURFOBJ* psoSource, // FIXME: why isn't this used? SURFOBJ* psoSource, // unused
SURFOBJ* psoMask, SURFOBJ* psoMask,
XLATEOBJ* ColorTranslation, XLATEOBJ* ColorTranslation, // unused
RECTL* DestRect, RECTL* prclDest,
POINTL* SourcePoint, POINTL* pptlSource, // unused
POINTL* MaskPoint, // FIXME: why isn't this used? POINTL* pptlMask,
BRUSHOBJ* pbo, BRUSHOBJ* pbo,
POINTL* BrushPoint, POINTL* pptlBrush,
ROP4 Rop4) ROP4 Rop4)
{ {
LONG x, y; LONG x, y;
@ -123,31 +123,31 @@ BltMask(SURFOBJ* psoDest,
else else
psurfPattern = NULL; psurfPattern = NULL;
pjMskLine = (PBYTE)psoMask->pvScan0 + SourcePoint->y * psoMask->lDelta + (SourcePoint->x >> 3); pjMskLine = (PBYTE)psoMask->pvScan0 + pptlMask->y * psoMask->lDelta + (pptlMask->x >> 3);
fjMaskBit0 = 0x80 >> (SourcePoint->x & 0x07); fjMaskBit0 = 0x80 >> (pptlMask->x & 0x07);
fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel; fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
if (psurfPattern) if (psurfPattern)
{ {
XlateObj = pebo ? pebo->XlateObject : NULL; XlateObj = pebo ? pebo->XlateObject : NULL;
PatternY = (DestRect->top - BrushPoint->y) % PatternHeight; PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
if (PatternY < 0) if (PatternY < 0)
{ {
PatternY += PatternHeight; PatternY += PatternHeight;
} }
PatternX0 = (DestRect->left - BrushPoint->x) % PatternWidth; PatternX0 = (prclDest->left - pptlBrush->x) % PatternWidth;
if (PatternX0 < 0) if (PatternX0 < 0)
{ {
PatternX0 += PatternWidth; PatternX0 += PatternWidth;
} }
for (y = DestRect->top; y < DestRect->bottom; y++) for (y = prclDest->top; y < prclDest->bottom; y++)
{ {
pjMskCurrent = pjMskLine; pjMskCurrent = pjMskLine;
fjMaskBit = fjMaskBit0; fjMaskBit = fjMaskBit0;
PatternX = PatternX0; PatternX = PatternX0;
for (x = DestRect->left; x < DestRect->right; x++) for (x = prclDest->left; x < prclDest->right; x++)
{ {
if (*pjMskCurrent & fjMaskBit) if (*pjMskCurrent & fjMaskBit)
{ {
@ -168,12 +168,12 @@ BltMask(SURFOBJ* psoDest,
else else
{ {
Pattern = pbo ? pbo->iSolidColor : 0; Pattern = pbo ? pbo->iSolidColor : 0;
for (y = DestRect->top; y < DestRect->bottom; y++) for (y = prclDest->top; y < prclDest->bottom; y++)
{ {
pjMskCurrent = pjMskLine; pjMskCurrent = pjMskLine;
fjMaskBit = fjMaskBit0; fjMaskBit = fjMaskBit0;
for (x = DestRect->left; x < DestRect->right; x++) for (x = prclDest->left; x < prclDest->right; x++)
{ {
if (*pjMskCurrent & fjMaskBit) if (*pjMskCurrent & fjMaskBit)
{ {
@ -1651,32 +1651,32 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
/* renders the alpha mask bitmap */ /* renders the alpha mask bitmap */
static BOOLEAN APIENTRY static BOOLEAN APIENTRY
AlphaBltMask(SURFOBJ* psoDest, AlphaBltMask(SURFOBJ* psoDest,
SURFOBJ* psoSource, SURFOBJ* psoSource, // unused
SURFOBJ* Mask, SURFOBJ* psoMask,
XLATEOBJ* ColorTranslation, XLATEOBJ* ColorTranslation,
XLATEOBJ* SrcColorTranslation, XLATEOBJ* SrcColorTranslation,
RECTL* DestRect, RECTL* prclDest,
POINTL* SourcePoint, POINTL* pptlSource, // unused
POINTL* MaskPoint, POINTL* pptlMask,
BRUSHOBJ* pbo, BRUSHOBJ* pbo,
POINTL* BrushPoint) POINTL* pptlBrush)
{ {
LONG i, j, dx, dy; LONG i, j, dx, dy;
int r, g, b; int r, g, b;
ULONG Background, BrushColor, NewColor; ULONG Background, BrushColor, NewColor;
BYTE *tMask, *lMask; BYTE *tMask, *lMask;
dx = DestRect->right - DestRect->left; dx = prclDest->right - prclDest->left;
dy = DestRect->bottom - DestRect->top; dy = prclDest->bottom - prclDest->top;
if (Mask != NULL) if (psoMask != NULL)
{ {
BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, pbo ? pbo->iSolidColor : 0); BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, pbo ? pbo->iSolidColor : 0);
r = (int)GetRValue(BrushColor); r = (int)GetRValue(BrushColor);
g = (int)GetGValue(BrushColor); g = (int)GetGValue(BrushColor);
b = (int)GetBValue(BrushColor); b = (int)GetBValue(BrushColor);
tMask = (PBYTE)Mask->pvScan0 + (SourcePoint->y * Mask->lDelta) + SourcePoint->x; tMask = (PBYTE)psoMask->pvScan0 + (pptlMask->y * psoMask->lDelta) + pptlMask->x;
for (j = 0; j < dy; j++) for (j = 0; j < dy; j++)
{ {
lMask = tMask; lMask = tMask;
@ -1687,11 +1687,11 @@ AlphaBltMask(SURFOBJ* psoDest,
if (*lMask == 0xff) if (*lMask == 0xff)
{ {
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel( DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel(
psoDest, DestRect->left + i, DestRect->top + j, pbo ? pbo->iSolidColor : 0); psoDest, prclDest->left + i, prclDest->top + j, pbo ? pbo->iSolidColor : 0);
} }
else else
{ {
Background = DIB_GetSource(psoDest, DestRect->left + i, DestRect->top + j, Background = DIB_GetSource(psoDest, prclDest->left + i, prclDest->top + j,
SrcColorTranslation); SrcColorTranslation);
NewColor = NewColor =
@ -1701,12 +1701,12 @@ AlphaBltMask(SURFOBJ* psoDest,
Background = XLATEOBJ_iXlate(ColorTranslation, NewColor); Background = XLATEOBJ_iXlate(ColorTranslation, NewColor);
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel( DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel(
psoDest, DestRect->left + i, DestRect->top + j, Background); psoDest, prclDest->left + i, prclDest->top + j, Background);
} }
} }
lMask++; lMask++;
} }
tMask += Mask->lDelta; tMask += psoMask->lDelta;
} }
return TRUE; return TRUE;
} }
@ -1716,6 +1716,7 @@ AlphaBltMask(SURFOBJ* psoDest,
} }
} }
static
BOOL APIENTRY BOOL APIENTRY
EngMaskBitBlt(SURFOBJ *psoDest, EngMaskBitBlt(SURFOBJ *psoDest,
SURFOBJ *psoMask, SURFOBJ *psoMask,
@ -1723,8 +1724,7 @@ EngMaskBitBlt(SURFOBJ *psoDest,
XLATEOBJ *DestColorTranslation, XLATEOBJ *DestColorTranslation,
XLATEOBJ *SourceColorTranslation, XLATEOBJ *SourceColorTranslation,
RECTL *DestRect, RECTL *DestRect,
POINTL *SourcePoint, POINTL *pptlMask,
POINTL *MaskOrigin,
BRUSHOBJ *pbo, BRUSHOBJ *pbo,
POINTL *BrushOrigin) POINTL *BrushOrigin)
{ {
@ -1749,12 +1749,12 @@ EngMaskBitBlt(SURFOBJ *psoDest,
ASSERT(psoMask); ASSERT(psoMask);
if (NULL != SourcePoint) if (pptlMask)
{ {
InputRect.left = SourcePoint->x; InputRect.left = pptlMask->x;
InputRect.right = SourcePoint->x + (DestRect->right - DestRect->left); InputRect.right = pptlMask->x + (DestRect->right - DestRect->left);
InputRect.top = SourcePoint->y; InputRect.top = pptlMask->y;
InputRect.bottom = SourcePoint->y + (DestRect->bottom - DestRect->top); InputRect.bottom = pptlMask->y + (DestRect->bottom - DestRect->top);
} }
else else
{ {
@ -1764,29 +1764,12 @@ EngMaskBitBlt(SURFOBJ *psoDest,
InputRect.bottom = DestRect->bottom - DestRect->top; InputRect.bottom = DestRect->bottom - DestRect->top;
} }
if (! IntEngEnter(&EnterLeaveSource, psoDest, &InputRect, TRUE, &Translate, &psoInput))
{
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; OutputRect = *DestRect;
if (NULL != ClipRegion) if (NULL != ClipRegion)
{ {
if (OutputRect.left < ClipRegion->rclBounds.left) if (OutputRect.left < ClipRegion->rclBounds.left)
{ {
InputRect.left += ClipRegion->rclBounds.left - OutputRect.left; InputRect.left += ClipRegion->rclBounds.left - OutputRect.left;
InputPoint.x += ClipRegion->rclBounds.left - OutputRect.left;
OutputRect.left = ClipRegion->rclBounds.left; OutputRect.left = ClipRegion->rclBounds.left;
} }
if (ClipRegion->rclBounds.right < OutputRect.right) if (ClipRegion->rclBounds.right < OutputRect.right)
@ -1797,7 +1780,6 @@ EngMaskBitBlt(SURFOBJ *psoDest,
if (OutputRect.top < ClipRegion->rclBounds.top) if (OutputRect.top < ClipRegion->rclBounds.top)
{ {
InputRect.top += ClipRegion->rclBounds.top - OutputRect.top; InputRect.top += ClipRegion->rclBounds.top - OutputRect.top;
InputPoint.y += ClipRegion->rclBounds.top - OutputRect.top;
OutputRect.top = ClipRegion->rclBounds.top; OutputRect.top = ClipRegion->rclBounds.top;
} }
if (ClipRegion->rclBounds.bottom < OutputRect.bottom) if (ClipRegion->rclBounds.bottom < OutputRect.bottom)
@ -1807,6 +1789,14 @@ EngMaskBitBlt(SURFOBJ *psoDest,
} }
} }
if (! IntEngEnter(&EnterLeaveSource, psoMask, &InputRect, TRUE, &Translate, &psoInput))
{
return FALSE;
}
InputPoint.x = InputRect.left + Translate.x;
InputPoint.y = InputRect.top + Translate.y;
/* Check for degenerate case: if height or width of OutputRect is 0 pixels there's /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
nothing to do */ nothing to do */
if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top) if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
@ -1846,11 +1836,11 @@ EngMaskBitBlt(SURFOBJ *psoDest,
{ {
case DC_TRIVIAL: case DC_TRIVIAL:
if (psoMask->iBitmapFormat == BMF_8BPP) if (psoMask->iBitmapFormat == BMF_8BPP)
Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation, Ret = AlphaBltMask(psoOutput, NULL , psoInput, DestColorTranslation, SourceColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, pbo, &AdjustedBrushOrigin); &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin);
else else
Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation, Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, pbo, &AdjustedBrushOrigin, &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin,
R4_MASK); R4_MASK);
break; break;
case DC_RECT: case DC_RECT:
@ -1866,12 +1856,12 @@ EngMaskBitBlt(SURFOBJ *psoDest,
if (psoMask->iBitmapFormat == BMF_8BPP) if (psoMask->iBitmapFormat == BMF_8BPP)
{ {
Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation, Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation,
&CombinedRect, &Pt, MaskOrigin, pbo, &AdjustedBrushOrigin); &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin);
} }
else else
{ {
Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation, Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation,
&CombinedRect, &Pt, MaskOrigin, pbo, &AdjustedBrushOrigin, R4_MASK); &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin, R4_MASK);
} }
} }
break; break;
@ -1912,14 +1902,14 @@ EngMaskBitBlt(SURFOBJ *psoDest,
Ret = AlphaBltMask(psoOutput, psoInput, psoMask, Ret = AlphaBltMask(psoOutput, psoInput, psoMask,
DestColorTranslation, DestColorTranslation,
SourceColorTranslation, SourceColorTranslation,
&CombinedRect, &Pt, MaskOrigin, pbo, &CombinedRect, &Pt, pptlMask, pbo,
&AdjustedBrushOrigin) && Ret; &AdjustedBrushOrigin) && Ret;
} }
else else
{ {
Ret = BltMask(psoOutput, psoInput, psoMask, Ret = BltMask(psoOutput, psoInput, psoMask,
DestColorTranslation, &CombinedRect, &Pt, DestColorTranslation, &CombinedRect, &Pt,
MaskOrigin, pbo, &AdjustedBrushOrigin, pptlMask, pbo, &AdjustedBrushOrigin,
R4_MASK) && Ret; R4_MASK) && Ret;
} }
} }
@ -1943,8 +1933,7 @@ IntEngMaskBlt(SURFOBJ *psoDest,
XLATEOBJ *DestColorTranslation, XLATEOBJ *DestColorTranslation,
XLATEOBJ *SourceColorTranslation, XLATEOBJ *SourceColorTranslation,
RECTL *DestRect, RECTL *DestRect,
POINTL *SourcePoint, POINTL *pptlMask,
POINTL *MaskOrigin,
BRUSHOBJ *pbo, BRUSHOBJ *pbo,
POINTL *BrushOrigin) POINTL *BrushOrigin)
{ {
@ -1955,9 +1944,9 @@ IntEngMaskBlt(SURFOBJ *psoDest,
ASSERT(psoMask); ASSERT(psoMask);
if (NULL != SourcePoint) if (pptlMask)
{ {
InputPoint = *SourcePoint; InputPoint = *pptlMask;
} }
/* Clip against the bounds of the clipping region so we won't try to write /* Clip against the bounds of the clipping region so we won't try to write
@ -1989,15 +1978,15 @@ IntEngMaskBlt(SURFOBJ *psoDest,
This should really be done using a call to DrvSynchronizeSurface, This should really be done using a call to DrvSynchronizeSurface,
but the VMware driver doesn't hook that call. */ but the VMware driver doesn't hook that call. */
IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation, IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
DestRect, SourcePoint, MaskOrigin, pbo, BrushOrigin, DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
R4_NOOP, FALSE); R4_NOOP, FALSE);
ret = EngMaskBitBlt(psoDest, psoMask, ClipRegion, DestColorTranslation, SourceColorTranslation, ret = EngMaskBitBlt(psoDest, psoMask, ClipRegion, DestColorTranslation, SourceColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, pbo, BrushOrigin); &OutputRect, &InputPoint, pbo, BrushOrigin);
/* Dummy BitBlt to let driver know that something has changed. */ /* Dummy BitBlt to let driver know that something has changed. */
IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation, IntEngBitBltEx(psoDest, NULL, psoMask, ClipRegion, DestColorTranslation,
DestRect, SourcePoint, MaskOrigin, pbo, BrushOrigin, DestRect, pptlMask, pptlMask, pbo, BrushOrigin,
R4_NOOP, FALSE); R4_NOOP, FALSE);
MouseSafetyOnDrawEnd(psoDest); MouseSafetyOnDrawEnd(psoDest);

View file

@ -4,15 +4,14 @@
BOOL APIENTRY EngIntersectRect (PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2); BOOL APIENTRY EngIntersectRect (PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2);
VOID FASTCALL EngDeleteXlate (XLATEOBJ *XlateObj); VOID FASTCALL EngDeleteXlate (XLATEOBJ *XlateObj);
BOOL APIENTRY BOOL APIENTRY
IntEngMaskBlt(SURFOBJ *DestObj, IntEngMaskBlt(SURFOBJ *psoDest,
SURFOBJ *Mask, SURFOBJ *psoMask,
CLIPOBJ *ClipRegion, CLIPOBJ *ClipRegion,
XLATEOBJ *DestColorTranslation, XLATEOBJ *DestColorTranslation,
XLATEOBJ *SourceColorTranslation, XLATEOBJ *SourceColorTranslation,
RECTL *DestRect, RECTL *DestRect,
POINTL *SourcePoint, POINTL *pptlMask,
POINTL *MaskOrigin, BRUSHOBJ *pbo,
BRUSHOBJ *Brush,
POINTL *BrushOrigin); POINTL *BrushOrigin);
VOID FASTCALL VOID FASTCALL

View file

@ -3571,7 +3571,6 @@ GreExtTextOutW(
XlateObj, XlateObj,
XlateObj2, XlateObj2,
&DestRect, &DestRect,
&SourcePoint,
(PPOINTL)&MaskRect, (PPOINTL)&MaskRect,
&dc->eboText.BrushObject, &dc->eboText.BrushObject,
&BrushOrigin); &BrushOrigin);