Author: tkreuzer Date: Sun Mar 8 23:36:49 2015 New Revision: 66617
URL: http://svn.reactos.org/svn/reactos?rev=66617&view=rev Log: [WIN32K] Improve the situation with ROP handling, trying to make things clearer.
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c trunk/reactos/win32ss/gdi/ntgdi/dibobj.c trunk/reactos/win32ss/gdi/ntgdi/intgdi.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Sun Mar 8 23:36:49 2015 @@ -151,13 +151,13 @@ 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 @@ 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 @@ NULL, 0, 0, - dwTRop, + MAKEROP4(dwRop, dwRop), crBackColor); }
@@ -310,7 +311,7 @@ HBITMAP hbmMask, INT xMask, INT yMask, - DWORD dwRop, + DWORD dwRop4, IN DWORD crBackColor) { PDC DCDest; @@ -325,11 +326,11 @@ EXLATEOBJ exlo; XLATEOBJ *XlateObj = NULL; BOOL UsesSource; - - FIXUP_ROP(dwRop); // FIXME: why do we need this??? - - //DPRINT1("dwRop : 0x%08x\n", dwRop); - UsesSource = ROP_USES_SOURCE(dwRop); + ROP4 rop4; + + rop4 = WIN32_ROP4_TO_ENG_ROP4(dwRop4); + + UsesSource = ROP4_USES_SOURCE(rop4); if (!hdcDest || (UsesSource && !hdcSrc)) { EngSetLastError(ERROR_INVALID_PARAMETER); @@ -337,7 +338,7 @@ }
/* 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 @@ &MaskPoint, &DCDest->eboFill.BrushObject, &DCDest->dclevel.pbrFill->ptOrigin, - ROP_TO_ROP4(dwRop)); + rop4);
if (UsesSource) EXLATEOBJ_vCleanup(&exlo); @@ -516,7 +517,8 @@ return FALSE; }
-BOOL APIENTRY +BOOL +NTAPI GreStretchBltMask( HDC hDCDest, INT XOriginDest, @@ -528,7 +530,7 @@ INT YOriginSrc, INT WidthSrc, INT HeightSrc, - DWORD ROP, + DWORD dwRop4, IN DWORD dwBackColor, HDC hDCMask, INT XOriginMask, @@ -551,10 +553,12 @@ POINTL BrushOrigin; BOOL UsesSource; BOOL UsesMask; - - FIXUP_ROP(ROP); - UsesSource = ROP_USES_SOURCE(ROP); - UsesMask = ROP_USES_MASK(ROP); + ROP4 rop4; + + 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 @@ BitmapMask ? &MaskPoint : NULL, &DCDest->eboFill.BrushObject, &BrushOrigin, - ROP_TO_ROP4(ROP)); + rop4); if (UsesSource) { EXLATEOBJ_vCleanup(&exlo); @@ -726,10 +730,10 @@ 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 @@ YOriginSrc, WidthSrc, HeightSrc, - dwTRop, + MAKEROP4(dwRop3 & 0xFF0000, dwRop3), dwBackColor, NULL, 0, @@ -757,7 +761,7 @@ INT YLeft, INT Width, INT Height, - DWORD dwRop, + DWORD dwRop3, PEBRUSHOBJ pebo) { RECTL DestRect; @@ -769,8 +773,6 @@ ASSERT(pebo); pbrush = pebo->pbrush; ASSERT(pbrush); - - FIXUP_ROP(dwRop);
if (pbrush->flAttrs & BR_IS_NULL) { @@ -817,18 +819,17 @@
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 @@ 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 */
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Sun Mar 8 23:36:49 2015 @@ -1274,10 +1274,6 @@ 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 @@ NULL, &pdc->eboFill.BrushObject, NULL, - ROP_TO_ROP4(dwRop)); + WIN32_ROP3_TO_ENG_ROP4(dwRop));
/* Cleanup */ DC_vFinishBlit(pdc, NULL);
Modified: trunk/reactos/win32ss/gdi/ntgdi/intgdi.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/intgdi.h?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/intgdi.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/intgdi.h [iso-8859-1] Sun Mar 8 23:36:49 2015 @@ -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)