mirror of
https://github.com/reactos/reactos.git
synced 2025-01-07 14:51:00 +00:00
[WIN32K]
Improve the situation with ROP handling, trying to make things clearer. svn path=/trunk/; revision=66617
This commit is contained in:
parent
ebd0c06809
commit
16c191f8a8
3 changed files with 47 additions and 50 deletions
|
@ -151,13 +151,13 @@ NtGdiBitBlt(
|
||||||
HDC hDCSrc,
|
HDC hDCSrc,
|
||||||
INT XSrc,
|
INT XSrc,
|
||||||
INT YSrc,
|
INT YSrc,
|
||||||
DWORD ROP,
|
DWORD dwRop,
|
||||||
IN DWORD crBackColor,
|
IN DWORD crBackColor,
|
||||||
IN FLONG fl)
|
IN FLONG fl)
|
||||||
{
|
{
|
||||||
DWORD dwTRop;
|
|
||||||
|
|
||||||
if (ROP & CAPTUREBLT)
|
if (dwRop & CAPTUREBLT)
|
||||||
|
{
|
||||||
return NtGdiStretchBlt(hDCDest,
|
return NtGdiStretchBlt(hDCDest,
|
||||||
XDest,
|
XDest,
|
||||||
YDest,
|
YDest,
|
||||||
|
@ -168,10 +168,11 @@ NtGdiBitBlt(
|
||||||
YSrc,
|
YSrc,
|
||||||
Width,
|
Width,
|
||||||
Height,
|
Height,
|
||||||
ROP,
|
dwRop,
|
||||||
crBackColor);
|
crBackColor);
|
||||||
|
}
|
||||||
|
|
||||||
dwTRop = ROP & ~(NOMIRRORBITMAP|CAPTUREBLT);
|
dwRop = dwRop & ~(NOMIRRORBITMAP|CAPTUREBLT);
|
||||||
|
|
||||||
/* Forward to NtGdiMaskBlt */
|
/* Forward to NtGdiMaskBlt */
|
||||||
// TODO: What's fl for? LOL not to send this to MaskBit!
|
// TODO: What's fl for? LOL not to send this to MaskBit!
|
||||||
|
@ -186,7 +187,7 @@ NtGdiBitBlt(
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
dwTRop,
|
MAKEROP4(dwRop, dwRop),
|
||||||
crBackColor);
|
crBackColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +311,7 @@ NtGdiMaskBlt(
|
||||||
HBITMAP hbmMask,
|
HBITMAP hbmMask,
|
||||||
INT xMask,
|
INT xMask,
|
||||||
INT yMask,
|
INT yMask,
|
||||||
DWORD dwRop,
|
DWORD dwRop4,
|
||||||
IN DWORD crBackColor)
|
IN DWORD crBackColor)
|
||||||
{
|
{
|
||||||
PDC DCDest;
|
PDC DCDest;
|
||||||
|
@ -325,11 +326,11 @@ NtGdiMaskBlt(
|
||||||
EXLATEOBJ exlo;
|
EXLATEOBJ exlo;
|
||||||
XLATEOBJ *XlateObj = NULL;
|
XLATEOBJ *XlateObj = NULL;
|
||||||
BOOL UsesSource;
|
BOOL UsesSource;
|
||||||
|
ROP4 rop4;
|
||||||
|
|
||||||
FIXUP_ROP(dwRop); // FIXME: why do we need this???
|
rop4 = WIN32_ROP4_TO_ENG_ROP4(dwRop4);
|
||||||
|
|
||||||
//DPRINT1("dwRop : 0x%08x\n", dwRop);
|
UsesSource = ROP4_USES_SOURCE(rop4);
|
||||||
UsesSource = ROP_USES_SOURCE(dwRop);
|
|
||||||
if (!hdcDest || (UsesSource && !hdcSrc))
|
if (!hdcDest || (UsesSource && !hdcSrc))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
@ -337,7 +338,7 @@ NtGdiMaskBlt(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we need a mask and have a mask bitmap */
|
/* Check if we need a mask and have a mask bitmap */
|
||||||
if (ROP_USES_MASK(dwRop) && (hbmMask != NULL))
|
if (ROP4_USES_MASK(rop4) && (hbmMask != NULL))
|
||||||
{
|
{
|
||||||
/* Reference the mask bitmap */
|
/* Reference the mask bitmap */
|
||||||
psurfMask = SURFACE_ShareLockSurface(hbmMask);
|
psurfMask = SURFACE_ShareLockSurface(hbmMask);
|
||||||
|
@ -481,7 +482,7 @@ NtGdiMaskBlt(
|
||||||
&MaskPoint,
|
&MaskPoint,
|
||||||
&DCDest->eboFill.BrushObject,
|
&DCDest->eboFill.BrushObject,
|
||||||
&DCDest->dclevel.pbrFill->ptOrigin,
|
&DCDest->dclevel.pbrFill->ptOrigin,
|
||||||
ROP_TO_ROP4(dwRop));
|
rop4);
|
||||||
|
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
EXLATEOBJ_vCleanup(&exlo);
|
EXLATEOBJ_vCleanup(&exlo);
|
||||||
|
@ -516,7 +517,8 @@ NtGdiPlgBlt(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL
|
||||||
|
NTAPI
|
||||||
GreStretchBltMask(
|
GreStretchBltMask(
|
||||||
HDC hDCDest,
|
HDC hDCDest,
|
||||||
INT XOriginDest,
|
INT XOriginDest,
|
||||||
|
@ -528,7 +530,7 @@ GreStretchBltMask(
|
||||||
INT YOriginSrc,
|
INT YOriginSrc,
|
||||||
INT WidthSrc,
|
INT WidthSrc,
|
||||||
INT HeightSrc,
|
INT HeightSrc,
|
||||||
DWORD ROP,
|
DWORD dwRop4,
|
||||||
IN DWORD dwBackColor,
|
IN DWORD dwBackColor,
|
||||||
HDC hDCMask,
|
HDC hDCMask,
|
||||||
INT XOriginMask,
|
INT XOriginMask,
|
||||||
|
@ -551,10 +553,12 @@ GreStretchBltMask(
|
||||||
POINTL BrushOrigin;
|
POINTL BrushOrigin;
|
||||||
BOOL UsesSource;
|
BOOL UsesSource;
|
||||||
BOOL UsesMask;
|
BOOL UsesMask;
|
||||||
|
ROP4 rop4;
|
||||||
|
|
||||||
FIXUP_ROP(ROP);
|
rop4 = WIN32_ROP4_TO_ENG_ROP4(dwRop4);
|
||||||
UsesSource = ROP_USES_SOURCE(ROP);
|
|
||||||
UsesMask = ROP_USES_MASK(ROP);
|
UsesSource = ROP4_USES_SOURCE(rop4);
|
||||||
|
UsesMask = ROP4_USES_MASK(rop4);
|
||||||
|
|
||||||
if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc)
|
if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc)
|
||||||
{
|
{
|
||||||
|
@ -692,7 +696,7 @@ GreStretchBltMask(
|
||||||
BitmapMask ? &MaskPoint : NULL,
|
BitmapMask ? &MaskPoint : NULL,
|
||||||
&DCDest->eboFill.BrushObject,
|
&DCDest->eboFill.BrushObject,
|
||||||
&BrushOrigin,
|
&BrushOrigin,
|
||||||
ROP_TO_ROP4(ROP));
|
rop4);
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
EXLATEOBJ_vCleanup(&exlo);
|
EXLATEOBJ_vCleanup(&exlo);
|
||||||
|
@ -726,10 +730,10 @@ NtGdiStretchBlt(
|
||||||
INT YOriginSrc,
|
INT YOriginSrc,
|
||||||
INT WidthSrc,
|
INT WidthSrc,
|
||||||
INT HeightSrc,
|
INT HeightSrc,
|
||||||
DWORD ROP,
|
DWORD dwRop3,
|
||||||
IN DWORD dwBackColor)
|
IN DWORD dwBackColor)
|
||||||
{
|
{
|
||||||
DWORD dwTRop = ROP & ~(NOMIRRORBITMAP|CAPTUREBLT);
|
dwRop3 = dwRop3 & ~(NOMIRRORBITMAP|CAPTUREBLT);
|
||||||
|
|
||||||
return GreStretchBltMask(
|
return GreStretchBltMask(
|
||||||
hDCDest,
|
hDCDest,
|
||||||
|
@ -742,7 +746,7 @@ NtGdiStretchBlt(
|
||||||
YOriginSrc,
|
YOriginSrc,
|
||||||
WidthSrc,
|
WidthSrc,
|
||||||
HeightSrc,
|
HeightSrc,
|
||||||
dwTRop,
|
MAKEROP4(dwRop3 & 0xFF0000, dwRop3),
|
||||||
dwBackColor,
|
dwBackColor,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
|
@ -757,7 +761,7 @@ IntPatBlt(
|
||||||
INT YLeft,
|
INT YLeft,
|
||||||
INT Width,
|
INT Width,
|
||||||
INT Height,
|
INT Height,
|
||||||
DWORD dwRop,
|
DWORD dwRop3,
|
||||||
PEBRUSHOBJ pebo)
|
PEBRUSHOBJ pebo)
|
||||||
{
|
{
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
|
@ -770,8 +774,6 @@ IntPatBlt(
|
||||||
pbrush = pebo->pbrush;
|
pbrush = pebo->pbrush;
|
||||||
ASSERT(pbrush);
|
ASSERT(pbrush);
|
||||||
|
|
||||||
FIXUP_ROP(dwRop);
|
|
||||||
|
|
||||||
if (pbrush->flAttrs & BR_IS_NULL)
|
if (pbrush->flAttrs & BR_IS_NULL)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -817,18 +819,17 @@ IntPatBlt(
|
||||||
|
|
||||||
psurf = pdc->dclevel.pSurface;
|
psurf = pdc->dclevel.pSurface;
|
||||||
|
|
||||||
ret = IntEngBitBlt(
|
ret = IntEngBitBlt(&psurf->SurfObj,
|
||||||
&psurf->SurfObj,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&pdc->co.ClipObj,
|
||||||
&pdc->co.ClipObj,
|
NULL,
|
||||||
NULL,
|
&DestRect,
|
||||||
&DestRect,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
&pebo->BrushObject,
|
||||||
&pebo->BrushObject,
|
&BrushOrigin,
|
||||||
&BrushOrigin,
|
WIN32_ROP3_TO_ENG_ROP4(dwRop3));
|
||||||
ROP_TO_ROP4(dwRop));
|
|
||||||
|
|
||||||
DC_vFinishBlit(pdc, NULL);
|
DC_vFinishBlit(pdc, NULL);
|
||||||
|
|
||||||
|
@ -906,15 +907,14 @@ NtGdiPatBlt(
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
PDC pdc;
|
PDC pdc;
|
||||||
|
|
||||||
/* Mask away everything except foreground rop index */
|
/* Convert the ROP3 to a ROP4 */
|
||||||
dwRop = dwRop & 0x00FF0000;
|
dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop);
|
||||||
dwRop |= dwRop << 8;
|
|
||||||
|
|
||||||
/* Check if the rop uses a source */
|
/* Check if the rop uses a source */
|
||||||
if (ROP_USES_SOURCE(dwRop))
|
if (WIN32_ROP4_USES_SOURCE(dwRop))
|
||||||
{
|
{
|
||||||
/* This is not possible */
|
/* This is not possible */
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lock the DC */
|
/* Lock the DC */
|
||||||
|
|
|
@ -1274,10 +1274,6 @@ NtGdiStretchDIBitsInternal(
|
||||||
pdc->pdcattr->crBackgroundClr,
|
pdc->pdcattr->crBackgroundClr,
|
||||||
pdc->pdcattr->crForegroundClr);
|
pdc->pdcattr->crForegroundClr);
|
||||||
|
|
||||||
/* Mask away everything except foreground rop index */
|
|
||||||
dwRop = dwRop & 0x00FF0000;
|
|
||||||
dwRop |= dwRop << 8;
|
|
||||||
|
|
||||||
/* Perform the stretch operation */
|
/* Perform the stretch operation */
|
||||||
bResult = IntEngStretchBlt(&psurfDst->SurfObj,
|
bResult = IntEngStretchBlt(&psurfDst->SurfObj,
|
||||||
&psurfTmp->SurfObj,
|
&psurfTmp->SurfObj,
|
||||||
|
@ -1290,7 +1286,7 @@ NtGdiStretchDIBitsInternal(
|
||||||
NULL,
|
NULL,
|
||||||
&pdc->eboFill.BrushObject,
|
&pdc->eboFill.BrushObject,
|
||||||
NULL,
|
NULL,
|
||||||
ROP_TO_ROP4(dwRop));
|
WIN32_ROP3_TO_ENG_ROP4(dwRop));
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
DC_vFinishBlit(pdc, NULL);
|
DC_vFinishBlit(pdc, NULL);
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define ROP_USES_SOURCE(Rop) (((((Rop) & 0xCC0000) >> 2) != ((Rop) & 0x330000)) || ((((Rop) & 0xCC000000) >> 2) != ((Rop) & 0x33000000)))
|
/* Convert WIN32 ROP into an ENG ROP */
|
||||||
#define ROP_USES_MASK(Rop) (((Rop) & 0xFF000000) != (((Rop) & 0xff0000) << 8))
|
#define WIN32_ROP3_TO_ENG_ROP4(dwRop4) ((((dwRop4) & 0x00FF0000) >> 16) | (((dwRop4) & 0x00FF0000) >> 8))
|
||||||
#define FIXUP_ROP(Rop) if(((Rop) & 0xFF000000) == 0) Rop = MAKEROP4((Rop), (Rop))
|
#define WIN32_ROP4_TO_ENG_ROP4(dwRop4) ((dwRop4) >> 16)
|
||||||
#define ROP_TO_ROP4(Rop) ((Rop) >> 16)
|
|
||||||
|
#define WIN32_ROP4_USES_SOURCE(Rop) ((((Rop) & 0xCCCC0000) >> 2) != ((Rop) & 0x33330000))
|
||||||
|
|
||||||
/* The range of valid ROP2 values is 1 .. 16 */
|
/* The range of valid ROP2 values is 1 .. 16 */
|
||||||
#define FIXUP_ROP2(rop2) ((((rop2) - 1) & 0xF) + 1)
|
#define FIXUP_ROP2(rop2) ((((rop2) - 1) & 0xF) + 1)
|
||||||
|
|
Loading…
Reference in a new issue