mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
[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:
parent
9e97547323
commit
ba31bc03ca
|
@ -48,9 +48,8 @@ BltMask(SURFOBJ* psoDest,
|
||||||
LONG PatternX0 = 0, PatternX = 0, PatternY = 0;
|
LONG PatternX0 = 0, PatternX = 0, PatternY = 0;
|
||||||
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
|
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
|
||||||
PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
|
PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
|
||||||
XLATEOBJ *XlateObj;
|
|
||||||
ULONG Pattern = 0;
|
ULONG Pattern = 0;
|
||||||
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
HBITMAP hbmPattern;
|
||||||
|
|
||||||
if (psoMask == NULL)
|
if (psoMask == NULL)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +60,8 @@ BltMask(SURFOBJ* psoDest,
|
||||||
{
|
{
|
||||||
pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||||
|
|
||||||
psurfPattern = SURFACE_LockSurface(pebo->pbrush->hbmPattern);
|
hbmPattern = EBRUSHOBJ_pvGetEngBrush(pebo);
|
||||||
|
psurfPattern = SURFACE_LockSurface(hbmPattern);
|
||||||
if (psurfPattern != NULL)
|
if (psurfPattern != NULL)
|
||||||
{
|
{
|
||||||
psoPattern = &psurfPattern->SurfObj;
|
psoPattern = &psurfPattern->SurfObj;
|
||||||
|
@ -79,9 +79,6 @@ BltMask(SURFOBJ* psoDest,
|
||||||
fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
|
fnDest_PutPixel = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel;
|
||||||
if (psurfPattern)
|
if (psurfPattern)
|
||||||
{
|
{
|
||||||
XlateObj = IntCreateBrushXlate(pebo->pbrush,
|
|
||||||
psurfDest,
|
|
||||||
pebo->crCurrentBack);
|
|
||||||
PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
|
PatternY = (prclDest->top - pptlBrush->y) % PatternHeight;
|
||||||
if (PatternY < 0)
|
if (PatternY < 0)
|
||||||
{
|
{
|
||||||
|
@ -104,8 +101,7 @@ BltMask(SURFOBJ* psoDest,
|
||||||
if (*pjMskCurrent & fjMaskBit)
|
if (*pjMskCurrent & fjMaskBit)
|
||||||
{
|
{
|
||||||
fnDest_PutPixel(psoDest, x, y,
|
fnDest_PutPixel(psoDest, x, y,
|
||||||
XLATEOBJ_iXlate(XlateObj,
|
fnPattern_GetPixel(psoPattern, PatternX, PatternY));
|
||||||
fnPattern_GetPixel(psoPattern, PatternX, PatternY)));
|
|
||||||
}
|
}
|
||||||
fjMaskBit = _rotr8(fjMaskBit, 1);
|
fjMaskBit = _rotr8(fjMaskBit, 1);
|
||||||
pjMskCurrent += (fjMaskBit >> 7);
|
pjMskCurrent += (fjMaskBit >> 7);
|
||||||
|
@ -116,9 +112,6 @@ BltMask(SURFOBJ* psoDest,
|
||||||
PatternY++;
|
PatternY++;
|
||||||
PatternY %= PatternHeight;
|
PatternY %= PatternHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XlateObj)
|
|
||||||
EngDeleteXlate(XlateObj);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -183,8 +176,7 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
||||||
PEBRUSHOBJ GdiBrush = NULL;
|
PEBRUSHOBJ GdiBrush = NULL;
|
||||||
SURFACE *psurfPattern;
|
SURFACE *psurfPattern;
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
SURFACE *psurfDest = CONTAINING_RECORD(OutputObj, SURFACE, SurfObj);
|
HBITMAP hbmPattern;
|
||||||
XLATEOBJ *XlatePatternToDest = NULL;
|
|
||||||
|
|
||||||
BltInfo.DestSurface = OutputObj;
|
BltInfo.DestSurface = OutputObj;
|
||||||
BltInfo.SourceSurface = InputObj;
|
BltInfo.SourceSurface = InputObj;
|
||||||
|
@ -205,7 +197,9 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
||||||
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
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;
|
BltInfo.PatternSurface = &psurfPattern->SurfObj;
|
||||||
}
|
}
|
||||||
|
@ -213,10 +207,6 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
||||||
{
|
{
|
||||||
/* FIXME - What to do here? */
|
/* FIXME - What to do here? */
|
||||||
}
|
}
|
||||||
XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
|
|
||||||
psurfDest,
|
|
||||||
GdiBrush->crCurrentBack);
|
|
||||||
BltInfo.XlatePatternToDest = XlatePatternToDest;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -225,11 +215,8 @@ CallDibBitBlt(SURFOBJ* OutputObj,
|
||||||
|
|
||||||
Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
|
Result = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
|
||||||
|
|
||||||
if (XlatePatternToDest)
|
|
||||||
EngDeleteXlate(XlatePatternToDest);
|
|
||||||
|
|
||||||
/* Pattern brush */
|
/* Pattern brush */
|
||||||
if (psurfPattern != NULL)
|
if (psurfPattern)
|
||||||
{
|
{
|
||||||
SURFACE_UnlockSurface(psurfPattern);
|
SURFACE_UnlockSurface(psurfPattern);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,8 +276,10 @@ BRUSHOBJ_pvGetRbrush(
|
||||||
if (!bResult)
|
if (!bResult)
|
||||||
{
|
{
|
||||||
if (pbo->pvRbrush)
|
if (pbo->pvRbrush)
|
||||||
|
{
|
||||||
EngFreeMem(pbo->pvRbrush);
|
EngFreeMem(pbo->pvRbrush);
|
||||||
pbo->pvRbrush = NULL;
|
pbo->pvRbrush = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,8 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
||||||
SURFACE* psurfPattern;
|
SURFACE* psurfPattern;
|
||||||
PEBRUSHOBJ GdiBrush = NULL;
|
PEBRUSHOBJ GdiBrush = NULL;
|
||||||
SURFOBJ* PatternSurface = NULL;
|
SURFOBJ* PatternSurface = NULL;
|
||||||
XLATEOBJ* XlatePatternToDest = NULL;
|
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
HBITMAP hbmPattern;
|
||||||
|
|
||||||
if (BrushOrigin == NULL)
|
if (BrushOrigin == NULL)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +54,8 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
||||||
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
GdiBrush = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject);
|
||||||
psurfPattern = SURFACE_LockSurface(GdiBrush->pbrush->hbmPattern);
|
hbmPattern = EBRUSHOBJ_pvGetEngBrush(GdiBrush);
|
||||||
|
psurfPattern = SURFACE_LockSurface(hbmPattern);
|
||||||
if (psurfPattern)
|
if (psurfPattern)
|
||||||
{
|
{
|
||||||
PatternSurface = &psurfPattern->SurfObj;
|
PatternSurface = &psurfPattern->SurfObj;
|
||||||
|
@ -64,9 +64,6 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
||||||
{
|
{
|
||||||
/* FIXME - What to do here? */
|
/* FIXME - What to do here? */
|
||||||
}
|
}
|
||||||
XlatePatternToDest = IntCreateBrushXlate(GdiBrush->pbrush,
|
|
||||||
psurfDest,
|
|
||||||
GdiBrush->crCurrentBack);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -76,12 +73,7 @@ CallDibStretchBlt(SURFOBJ* psoDest,
|
||||||
bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
|
bResult = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_StretchBlt(
|
||||||
psoDest, psoSource, Mask, PatternSurface,
|
psoDest, psoSource, Mask, PatternSurface,
|
||||||
OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
|
OutputRect, InputRect, MaskOrigin, pbo, &RealBrushOrigin,
|
||||||
ColorTranslation, XlatePatternToDest, Rop4);
|
ColorTranslation, NULL, Rop4);
|
||||||
|
|
||||||
if (XlatePatternToDest)
|
|
||||||
{
|
|
||||||
EngDeleteXlate(XlatePatternToDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Pattern brush */
|
/* Pattern brush */
|
||||||
if (psurfPattern)
|
if (psurfPattern)
|
||||||
|
@ -155,7 +147,7 @@ EngStretchBltROP(
|
||||||
/* Copy destination onto itself: nop */
|
/* Copy destination onto itself: nop */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputRect = *prclDest;
|
OutputRect = *prclDest;
|
||||||
if (OutputRect.right < OutputRect.left)
|
if (OutputRect.right < OutputRect.left)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +159,7 @@ EngStretchBltROP(
|
||||||
OutputRect.top = prclDest->bottom;
|
OutputRect.top = prclDest->bottom;
|
||||||
OutputRect.bottom = prclDest->top;
|
OutputRect.bottom = prclDest->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputRect = *prclSrc;
|
InputRect = *prclSrc;
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
|
@ -256,12 +248,12 @@ EngStretchBltROP(
|
||||||
switch (clippingType)
|
switch (clippingType)
|
||||||
{
|
{
|
||||||
case DC_TRIVIAL:
|
case DC_TRIVIAL:
|
||||||
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
||||||
ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
|
ColorTranslation, &OutputRect, &InputRect, MaskOrigin,
|
||||||
pbo, &AdjustedBrushOrigin, ROP4);
|
pbo, &AdjustedBrushOrigin, ROP4);
|
||||||
break;
|
break;
|
||||||
case DC_RECT:
|
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.left = ClipRegion->rclBounds.left + Translate.x;
|
||||||
ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
|
ClipRect.right = ClipRegion->rclBounds.right + Translate.x;
|
||||||
ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
|
ClipRect.top = ClipRegion->rclBounds.top + Translate.y;
|
||||||
|
@ -272,13 +264,13 @@ EngStretchBltROP(
|
||||||
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
|
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
|
||||||
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
|
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
|
||||||
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
|
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
|
||||||
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
||||||
ColorTranslation,
|
ColorTranslation,
|
||||||
&CombinedRect,
|
&CombinedRect,
|
||||||
&InputToCombinedRect,
|
&InputToCombinedRect,
|
||||||
MaskOrigin,
|
MaskOrigin,
|
||||||
pbo,
|
pbo,
|
||||||
&AdjustedBrushOrigin,
|
&AdjustedBrushOrigin,
|
||||||
ROP4);
|
ROP4);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -317,13 +309,13 @@ EngStretchBltROP(
|
||||||
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
|
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
|
||||||
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
|
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
|
||||||
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
|
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
|
||||||
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
Ret = (*BltRectFunc)(psoOutput, psoInput, Mask,
|
||||||
ColorTranslation,
|
ColorTranslation,
|
||||||
&CombinedRect,
|
&CombinedRect,
|
||||||
&InputToCombinedRect,
|
&InputToCombinedRect,
|
||||||
MaskOrigin,
|
MaskOrigin,
|
||||||
pbo,
|
pbo,
|
||||||
&AdjustedBrushOrigin,
|
&AdjustedBrushOrigin,
|
||||||
ROP4);
|
ROP4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,7 +407,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
InputClippedRect.top = DestRect->bottom;
|
InputClippedRect.top = DestRect->bottom;
|
||||||
InputClippedRect.bottom = DestRect->top;
|
InputClippedRect.bottom = DestRect->top;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
if (NULL == SourceRect || NULL == psoSource)
|
if (NULL == SourceRect || NULL == psoSource)
|
||||||
|
@ -423,14 +415,14 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
InputRect = *SourceRect;
|
InputRect = *SourceRect;
|
||||||
|
|
||||||
if (InputRect.right < InputRect.left ||
|
if (InputRect.right < InputRect.left ||
|
||||||
InputRect.bottom < InputRect.top)
|
InputRect.bottom < InputRect.top)
|
||||||
{
|
{
|
||||||
/* Everything clipped away, nothing to do */
|
/* Everything clipped away, nothing to do */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClipRegion)
|
if (ClipRegion)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +446,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
|
||||||
{
|
{
|
||||||
OutputRect = InputClippedRect;
|
OutputRect = InputClippedRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMaskOrigin != NULL)
|
if (pMaskOrigin != NULL)
|
||||||
{
|
{
|
||||||
MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;
|
MaskOrigin.x = pMaskOrigin->x; MaskOrigin.y = pMaskOrigin->y;
|
||||||
|
|
|
@ -124,4 +124,8 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
|
EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue