diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index 9bcafe854e4..c3f39ab6c98 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -151,13 +151,13 @@ NtGdiBitBlt( HDC hDCSrc, INT XSrc, INT YSrc, - DWORD ROP, + DWORD dwRop, IN DWORD crBackColor, IN FLONG fl) { - DWORD dwTRop; - if (ROP & CAPTUREBLT) + if (dwRop & CAPTUREBLT) + { return NtGdiStretchBlt(hDCDest, XDest, YDest, @@ -168,10 +168,11 @@ NtGdiBitBlt( YSrc, Width, Height, - ROP, + dwRop, crBackColor); + } - dwTRop = ROP & ~(NOMIRRORBITMAP|CAPTUREBLT); + dwRop = dwRop & ~(NOMIRRORBITMAP|CAPTUREBLT); /* Forward to NtGdiMaskBlt */ // TODO: What's fl for? LOL not to send this to MaskBit! @@ -186,7 +187,7 @@ NtGdiBitBlt( NULL, 0, 0, - dwTRop, + MAKEROP4(dwRop, dwRop), crBackColor); } @@ -310,7 +311,7 @@ NtGdiMaskBlt( HBITMAP hbmMask, INT xMask, INT yMask, - DWORD dwRop, + DWORD dwRop4, IN DWORD crBackColor) { PDC DCDest; @@ -325,11 +326,11 @@ NtGdiMaskBlt( EXLATEOBJ exlo; XLATEOBJ *XlateObj = NULL; 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 = ROP_USES_SOURCE(dwRop); + UsesSource = ROP4_USES_SOURCE(rop4); if (!hdcDest || (UsesSource && !hdcSrc)) { EngSetLastError(ERROR_INVALID_PARAMETER); @@ -337,7 +338,7 @@ NtGdiMaskBlt( } /* 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 */ psurfMask = SURFACE_ShareLockSurface(hbmMask); @@ -481,7 +482,7 @@ NtGdiMaskBlt( &MaskPoint, &DCDest->eboFill.BrushObject, &DCDest->dclevel.pbrFill->ptOrigin, - ROP_TO_ROP4(dwRop)); + rop4); if (UsesSource) EXLATEOBJ_vCleanup(&exlo); @@ -516,7 +517,8 @@ NtGdiPlgBlt( return FALSE; } -BOOL APIENTRY +BOOL +NTAPI GreStretchBltMask( HDC hDCDest, INT XOriginDest, @@ -528,7 +530,7 @@ GreStretchBltMask( INT YOriginSrc, INT WidthSrc, INT HeightSrc, - DWORD ROP, + DWORD dwRop4, IN DWORD dwBackColor, HDC hDCMask, INT XOriginMask, @@ -551,10 +553,12 @@ GreStretchBltMask( POINTL BrushOrigin; BOOL UsesSource; BOOL UsesMask; + ROP4 rop4; - FIXUP_ROP(ROP); - UsesSource = ROP_USES_SOURCE(ROP); - UsesMask = ROP_USES_MASK(ROP); + rop4 = WIN32_ROP4_TO_ENG_ROP4(dwRop4); + + UsesSource = ROP4_USES_SOURCE(rop4); + UsesMask = ROP4_USES_MASK(rop4); if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc) { @@ -692,7 +696,7 @@ GreStretchBltMask( BitmapMask ? &MaskPoint : NULL, &DCDest->eboFill.BrushObject, &BrushOrigin, - ROP_TO_ROP4(ROP)); + rop4); if (UsesSource) { EXLATEOBJ_vCleanup(&exlo); @@ -726,10 +730,10 @@ NtGdiStretchBlt( INT YOriginSrc, INT WidthSrc, INT HeightSrc, - DWORD ROP, + DWORD dwRop3, IN DWORD dwBackColor) { - DWORD dwTRop = ROP & ~(NOMIRRORBITMAP|CAPTUREBLT); + dwRop3 = dwRop3 & ~(NOMIRRORBITMAP|CAPTUREBLT); return GreStretchBltMask( hDCDest, @@ -742,7 +746,7 @@ NtGdiStretchBlt( YOriginSrc, WidthSrc, HeightSrc, - dwTRop, + MAKEROP4(dwRop3 & 0xFF0000, dwRop3), dwBackColor, NULL, 0, @@ -757,7 +761,7 @@ IntPatBlt( INT YLeft, INT Width, INT Height, - DWORD dwRop, + DWORD dwRop3, PEBRUSHOBJ pebo) { RECTL DestRect; @@ -770,8 +774,6 @@ IntPatBlt( pbrush = pebo->pbrush; ASSERT(pbrush); - FIXUP_ROP(dwRop); - if (pbrush->flAttrs & BR_IS_NULL) { return TRUE; @@ -817,18 +819,17 @@ IntPatBlt( psurf = pdc->dclevel.pSurface; - ret = IntEngBitBlt( - &psurf->SurfObj, - NULL, - NULL, - &pdc->co.ClipObj, - NULL, - &DestRect, - NULL, - NULL, - &pebo->BrushObject, - &BrushOrigin, - ROP_TO_ROP4(dwRop)); + ret = IntEngBitBlt(&psurf->SurfObj, + NULL, + NULL, + &pdc->co.ClipObj, + NULL, + &DestRect, + NULL, + NULL, + &pebo->BrushObject, + &BrushOrigin, + WIN32_ROP3_TO_ENG_ROP4(dwRop3)); DC_vFinishBlit(pdc, NULL); @@ -906,15 +907,14 @@ NtGdiPatBlt( BOOL bResult; PDC pdc; - /* Mask away everything except foreground rop index */ - dwRop = dwRop & 0x00FF0000; - dwRop |= dwRop << 8; + /* Convert the ROP3 to a ROP4 */ + dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop); /* Check if the rop uses a source */ - if (ROP_USES_SOURCE(dwRop)) + if (WIN32_ROP4_USES_SOURCE(dwRop)) { /* This is not possible */ - return 0; + return FALSE; } /* Lock the DC */ diff --git a/reactos/win32ss/gdi/ntgdi/dibobj.c b/reactos/win32ss/gdi/ntgdi/dibobj.c index 72ad853f729..ea03fa64f99 100644 --- a/reactos/win32ss/gdi/ntgdi/dibobj.c +++ b/reactos/win32ss/gdi/ntgdi/dibobj.c @@ -1274,10 +1274,6 @@ NtGdiStretchDIBitsInternal( pdc->pdcattr->crBackgroundClr, pdc->pdcattr->crForegroundClr); - /* Mask away everything except foreground rop index */ - dwRop = dwRop & 0x00FF0000; - dwRop |= dwRop << 8; - /* Perform the stretch operation */ bResult = IntEngStretchBlt(&psurfDst->SurfObj, &psurfTmp->SurfObj, @@ -1290,7 +1286,7 @@ NtGdiStretchDIBitsInternal( NULL, &pdc->eboFill.BrushObject, NULL, - ROP_TO_ROP4(dwRop)); + WIN32_ROP3_TO_ENG_ROP4(dwRop)); /* Cleanup */ DC_vFinishBlit(pdc, NULL); diff --git a/reactos/win32ss/gdi/ntgdi/intgdi.h b/reactos/win32ss/gdi/ntgdi/intgdi.h index 09cc538c94d..f0112beccf6 100644 --- a/reactos/win32ss/gdi/ntgdi/intgdi.h +++ b/reactos/win32ss/gdi/ntgdi/intgdi.h @@ -1,9 +1,10 @@ #pragma once -#define ROP_USES_SOURCE(Rop) (((((Rop) & 0xCC0000) >> 2) != ((Rop) & 0x330000)) || ((((Rop) & 0xCC000000) >> 2) != ((Rop) & 0x33000000))) -#define ROP_USES_MASK(Rop) (((Rop) & 0xFF000000) != (((Rop) & 0xff0000) << 8)) -#define FIXUP_ROP(Rop) if(((Rop) & 0xFF000000) == 0) Rop = MAKEROP4((Rop), (Rop)) -#define ROP_TO_ROP4(Rop) ((Rop) >> 16) +/* Convert WIN32 ROP into an ENG ROP */ +#define WIN32_ROP3_TO_ENG_ROP4(dwRop4) ((((dwRop4) & 0x00FF0000) >> 16) | (((dwRop4) & 0x00FF0000) >> 8)) +#define WIN32_ROP4_TO_ENG_ROP4(dwRop4) ((dwRop4) >> 16) + +#define WIN32_ROP4_USES_SOURCE(Rop) ((((Rop) & 0xCCCC0000) >> 2) != ((Rop) & 0x33330000)) /* The range of valid ROP2 values is 1 .. 16 */ #define FIXUP_ROP2(rop2) ((((rop2) - 1) & 0xF) + 1)