[win32k] Implement brush realization part 2 / 2

Use EBRUSHOBJ_pvGetEngBrush to get a handle to the realized (color translated) brush and use this instead of the original pattern when doing patblts. We don't use any XLATEOBJ anymore. I'll leave it to the interested reader to cleanup the DIB code from remnants of pattern to dest color translation.

svn path=/trunk/; revision=41892
This commit is contained in:
Timo Kreuzer 2009-07-11 20:15:37 +00:00
parent 9e97547323
commit ba31bc03ca
4 changed files with 36 additions and 51 deletions

View file

@ -48,9 +48,8 @@ BltMask(SURFOBJ* psoDest,
LONG PatternX0 = 0, PatternX = 0, PatternY = 0;
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
XLATEOBJ *XlateObj;
ULONG Pattern = 0;
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
HBITMAP hbmPattern;
if (psoMask == NULL)
{
@ -61,7 +60,8 @@ BltMask(SURFOBJ* psoDest,
{
pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
hbmPattern = EBRUSHOBJ_pvGetEngBrush(pebo);
psurfPattern = SURFACE_LockSurface(hbmPattern);
if (psurfPattern != NULL)
{
psoPattern = &psurfPattern->SurfObj;
@ -79,9 +79,6 @@ BltMask(SURFOBJ* psoDest,
fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
if (psurfPattern)
{
XlateObj = IntCreateBrushXlate(pebo->pbrush,
psurfDest,
pebo->crCurrentBack);
PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
if (PatternY < 0)
{
@ -104,8 +101,7 @@ BltMask(SURFOBJ* psoDest,
if (*pjMskCurrent & fjMaskBit)
{
fnDest_PutPixel(psoDest, x, y,
XLATEOBJ_iXlate(XlateObj,
fnPattern_GetPixel(psoPattern, PatternX, PatternY)));
fnPattern_GetPixel(psoPattern, PatternX, PatternY));
}
fjMaskBit = _rotr8(fjMaskBit, 1);
pjMskCurrent += (fjMaskBit >> 7);
@ -116,9 +112,6 @@ BltMask(SURFOBJ* psoDest,
PatternY++;
PatternY %= PatternHeight;
}
if (XlateObj)
EngDeleteXlate(XlateObj);
}
else
{
@ -183,8 +176,7 @@ CallDibBitBlt(SURFOBJ* OutputObj,
PEBRUSHOBJ GdiBrush = NULL;
SURFACE *psurfPattern;
BOOLEAN Result;
SURFACE *psurfDest = CONTAINING_RECORD(OutputObj, SURFACE, SurfObj);
XLATEOBJ *XlatePatternToDest = NULL;
HBITMAP hbmPattern;
BltInfo.DestSurface = OutputObj;
BltInfo.SourceSurface = InputObj;
@ -205,7 +197,9 @@ CallDibBitBlt(SURFOBJ* OutputObj,
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
{
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
if ((psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern)))
hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
psurfPattern = SURFACE_LockSurface(hbmPattern);
if (psurfPattern)
{
BltInfo.PatternSurface = &psurfPattern->SurfObj;
}
@ -213,10 +207,6 @@ CallDibBitBlt(SURFOBJ* OutputObj,
{
/* FIXME - What to do here? */
}
XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
psurfDest,
GdiBrush->crCurrentBack);
BltInfo.XlatePatternToDest = XlatePatternToDest;
}
else
{
@ -225,11 +215,8 @@ CallDibBitBlt(SURFOBJ* OutputObj,
Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
if (XlatePatternToDest)
EngDeleteXlate(XlatePatternToDest);
/* Pattern brush */
if (psurfPattern != NULL)
if (psurfPattern)
{
SURFACE_UnlockSurface(psurfPattern);
}

View file

@ -276,8 +276,10 @@ BRUSHOBJ_pvGetRbrush(
if (!bResult)
{
if (pbo->pvRbrush)
{
EngFreeMem(pbo->pvRbrush);
pbo->pvRbrush = NULL;
pbo->pvRbrush = NULL;
}
}
}

View file

@ -38,9 +38,8 @@ CallDibStretchBlt(SURFOBJ* psoDest,
SURFACE* psurfPattern;
PEBRUSHOBJ GdiBrush = NULL;
SURFOBJ* PatternSurface = NULL;
XLATEOBJ* XlatePatternToDest = NULL;
BOOL bResult;
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
HBITMAP hbmPattern;
if (BrushOrigin == NULL)
{
@ -55,7 +54,8 @@ CallDibStretchBlt(SURFOBJ* psoDest,
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
{
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern);
hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
psurfPattern = SURFACE_LockSurface(hbmPattern);
if (psurfPattern)
{
PatternSurface = &psurfPattern->SurfObj;
@ -64,9 +64,6 @@ CallDibStretchBlt(SURFOBJ* psoDest,
{
/* FIXME - What to do here? */
}
XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
psurfDest,
GdiBrush->crCurrentBack);
}
else
{
@ -76,12 +73,7 @@ CallDibStretchBlt(SURFOBJ* psoDest,
bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
psoDest, psoSource, Mask, PatternSurface,
OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
ColorTranslation, XlatePatternToDest, Rop4);
if (XlatePatternToDest)
{
EngDeleteXlate(XlatePatternToDest);
}
ColorTranslation, NULL, Rop4);
/* Pattern brush */
if (psurfPattern)
@ -155,7 +147,7 @@ EngStretchBltROP(
/* Copy destination onto itself: nop */
return TRUE;
}
OutputRect = *prclDest;
if (OutputRect.right < OutputRect.left)
{
@ -167,7 +159,7 @@ EngStretchBltROP(
OutputRect.top = prclDest->bottom;
OutputRect.bottom = prclDest->top;
}
InputRect = *prclSrc;
if (UsesSource)
{
@ -256,12 +248,12 @@ EngStretchBltROP(
switch (clippingType)
{
case DC_TRIVIAL:
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
pbo, &AdjustedBrushOrigin, ROP4);
break;
case DC_RECT:
// Clip the blt to the clip rectangle
// 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;
@ -272,13 +264,13 @@ EngStretchBltROP(
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
ColorTranslation,
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
ColorTranslation,
&CombinedRect,
&InputToCombinedRect,
MaskOrigin,
pbo,
&AdjustedBrushOrigin,
pbo,
&AdjustedBrushOrigin,
ROP4);
}
break;
@ -317,13 +309,13 @@ EngStretchBltROP(
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
ColorTranslation,
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
ColorTranslation,
&CombinedRect,
&InputToCombinedRect,
MaskOrigin,
pbo,
&AdjustedBrushOrigin,
pbo,
&AdjustedBrushOrigin,
ROP4);
}
}
@ -415,7 +407,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
InputClippedRect.top = DestRect->bottom;
InputClippedRect.bottom = DestRect->top;
}
if (UsesSource)
{
if (NULL == SourceRect || NULL == psoSource)
@ -423,14 +415,14 @@ IntEngStretchBlt(SURFOBJ *psoDest,
return FALSE;
}
InputRect = *SourceRect;
if (InputRect.right < InputRect.left ||
InputRect.bottom < InputRect.top)
{
/* Everything clipped away, nothing to do */
return TRUE;
}
}
}
if (ClipRegion)
{
@ -454,7 +446,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
{
OutputRect = InputClippedRect;
}
if (pMaskOrigin != NULL)
{
MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;

View file

@ -124,4 +124,8 @@ VOID
NTAPI
EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
PVOID
NTAPI
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
#endif