From bc7bba6f783cfe3a2a527348f32dd03f2febcd7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 6 Feb 2005 18:27:06 +0000 Subject: [PATCH] Pass ROP4 instead of ROP3 to drivers svn path=/trunk/; revision=13445 --- .../video/displays/vga/objects/bitblt.c | 29 ++-- .../video/displays/vga/objects/bitblt.h | 7 + reactos/subsys/win32k/dib/dib.c | 34 ++--- reactos/subsys/win32k/dib/dib.h | 3 - reactos/subsys/win32k/dib/dib16bpp.c | 4 +- reactos/subsys/win32k/dib/dib1bpp.c | 4 +- reactos/subsys/win32k/dib/dib24bpp.c | 4 +- reactos/subsys/win32k/dib/dib32bpp.c | 4 +- reactos/subsys/win32k/dib/dib4bpp.c | 4 +- reactos/subsys/win32k/dib/dib8bpp.c | 4 +- reactos/subsys/win32k/eng/bitblt.c | 124 +++++++++--------- reactos/subsys/win32k/eng/copybits.c | 2 +- reactos/subsys/win32k/eng/gradient.c | 15 +-- reactos/subsys/win32k/eng/mouse.c | 10 +- reactos/subsys/win32k/eng/transblt.c | 12 -- reactos/subsys/win32k/include/inteng.h | 13 +- reactos/subsys/win32k/objects/bitmaps.c | 7 +- reactos/subsys/win32k/objects/brush.c | 2 +- reactos/subsys/win32k/objects/fillshap.c | 2 +- reactos/subsys/win32k/objects/text.c | 4 +- 20 files changed, 141 insertions(+), 147 deletions(-) diff --git a/reactos/drivers/video/displays/vga/objects/bitblt.c b/reactos/drivers/video/displays/vga/objects/bitblt.c index 4726dffe890..fbdc29c46cb 100644 --- a/reactos/drivers/video/displays/vga/objects/bitblt.c +++ b/reactos/drivers/video/displays/vga/objects/bitblt.c @@ -188,20 +188,21 @@ VGADDI_BltBrush(SURFOBJ* Dest, SURFOBJ* Source, SURFOBJ* MaskSurf, } /* Punt pattern fills. */ - if ((Rop4 == PATCOPY || Rop4 == PATINVERT) && + if ((GET_OPINDEX_FROM_ROP4(Rop4) == GET_OPINDEX_FROM_ROP3(PATCOPY) + || GET_OPINDEX_FROM_ROP4(Rop4) == GET_OPINDEX_FROM_ROP3(PATINVERT)) && Brush->iSolidColor == 0xFFFFFFFF) { return(FALSE); } /* Get the brush colour. */ - switch (Rop4) + switch (GET_OPINDEX_FROM_ROP4(Rop4)) { - case PATCOPY: SolidColor = Brush->iSolidColor; break; - case PATINVERT: SolidColor = Brush->iSolidColor; RasterOp = VGA_XOR; break; - case WHITENESS: SolidColor = 0xF; break; - case BLACKNESS: SolidColor = 0x0; break; - case DSTINVERT: SolidColor = 0xF; RasterOp = VGA_XOR; break; + case GET_OPINDEX_FROM_ROP3(PATCOPY): SolidColor = Brush->iSolidColor; break; + case GET_OPINDEX_FROM_ROP3(PATINVERT): SolidColor = Brush->iSolidColor; RasterOp = VGA_XOR; break; + case GET_OPINDEX_FROM_ROP3(WHITENESS): SolidColor = 0xF; break; + case GET_OPINDEX_FROM_ROP3(BLACKNESS): SolidColor = 0x0; break; + case GET_OPINDEX_FROM_ROP3(DSTINVERT): SolidColor = 0xF; RasterOp = VGA_XOR; break; } /* Select write mode 3. */ @@ -398,15 +399,15 @@ DrvBitBlt(SURFOBJ *Dest, switch (rop4) { - case BLACKNESS: - case PATCOPY: - case WHITENESS: - case PATINVERT: - case DSTINVERT: + case ROP3_TO_ROP4(BLACKNESS): + case ROP3_TO_ROP4(PATCOPY): + case ROP3_TO_ROP4(WHITENESS): + case ROP3_TO_ROP4(PATINVERT): + case ROP3_TO_ROP4(DSTINVERT): BltRectFunc = VGADDI_BltBrush; break; - case SRCCOPY: + case ROP3_TO_ROP4(SRCCOPY): if (BMF_4BPP == Source->iBitmapFormat && BMF_4BPP == Dest->iBitmapFormat) { BltRectFunc = VGADDI_BltSrc; @@ -417,7 +418,7 @@ DrvBitBlt(SURFOBJ *Dest, } break; - case 0xAACC: + case R4_MASK: BltRectFunc = VGADDI_BltMask; break; diff --git a/reactos/drivers/video/displays/vga/objects/bitblt.h b/reactos/drivers/video/displays/vga/objects/bitblt.h index 2f5d359eb81..e52edf9247b 100644 --- a/reactos/drivers/video/displays/vga/objects/bitblt.h +++ b/reactos/drivers/video/displays/vga/objects/bitblt.h @@ -20,3 +20,10 @@ #define BB_TARGET_ONLY 0x0002 #define BB_SOURCE_COPY 0x0004 #define BB_PATTERN_COPY 0x0008 + +#define GET_OPINDEX_FROM_ROP3(Rop3) (((Rop3) >> 16) & 0xff) +#define GET_OPINDEX_FROM_ROP4(Rop4) ((Rop4) & 0xff) +#define ROP3_TO_ROP4(Rop3) ((((Rop3) >> 8) & 0xff00) | (((Rop3) >> 16) & 0x00ff)) +#define R3_OPINDEX_SRCCOPY 0xcc +#define R3_OPINDEX_NOOP 0xaa +#define R4_MASK ((R3_OPINDEX_NOOP << 8) | R3_OPINDEX_SRCCOPY) diff --git a/reactos/subsys/win32k/dib/dib.c b/reactos/subsys/win32k/dib/dib.c index 97f0d691a79..7b6e6547df1 100644 --- a/reactos/subsys/win32k/dib/dib.c +++ b/reactos/subsys/win32k/dib/dib.c @@ -156,25 +156,25 @@ DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern) /* Optimized code for the various named rop codes. */ switch (Rop) { - case BLACKNESS: return(0); - case NOTSRCERASE: return(~(Dest | Source)); - case NOTSRCCOPY: return(~Source); - case SRCERASE: return((~Dest) & Source); - case DSTINVERT: return(~Dest); - case PATINVERT: return(Dest ^ Pattern); - case SRCINVERT: return(Dest ^ Source); - case SRCAND: return(Dest & Source); - case MERGEPAINT: return(Dest & (~Source)); - case SRCPAINT: return(Dest | Source); - case MERGECOPY: return(Source & Pattern); - case SRCCOPY: return(Source); - case PATCOPY: return(Pattern); - case PATPAINT: return(Dest | (~Source) | Pattern); - case WHITENESS: return(0xFFFFFFFF); + case ROP3_TO_ROP4(BLACKNESS): return(0); + case ROP3_TO_ROP4(NOTSRCERASE): return(~(Dest | Source)); + case ROP3_TO_ROP4(NOTSRCCOPY): return(~Source); + case ROP3_TO_ROP4(SRCERASE): return((~Dest) & Source); + case ROP3_TO_ROP4(DSTINVERT): return(~Dest); + case ROP3_TO_ROP4(PATINVERT): return(Dest ^ Pattern); + case ROP3_TO_ROP4(SRCINVERT): return(Dest ^ Source); + case ROP3_TO_ROP4(SRCAND): return(Dest & Source); + case ROP3_TO_ROP4(MERGEPAINT): return(Dest & (~Source)); + case ROP3_TO_ROP4(SRCPAINT): return(Dest | Source); + case ROP3_TO_ROP4(MERGECOPY): return(Source & Pattern); + case ROP3_TO_ROP4(SRCCOPY): return(Source); + case ROP3_TO_ROP4(PATCOPY): return(Pattern); + case ROP3_TO_ROP4(PATPAINT): return(Dest | (~Source) | Pattern); + case ROP3_TO_ROP4(WHITENESS): return(0xFFFFFFFF); } /* Expand the ROP operation to all four bytes */ - Rop &= 0x00FF0000; - Rop = (Rop << 8) | (Rop) | (Rop >> 8) | (Rop >> 16); + Rop &= 0xFF; + Rop |= (Rop << 24) | (Rop << 16) | (Rop << 8); /* Do the operation on four bits simultaneously. */ Result = 0; for (i = 0; i < 8; i++) diff --git a/reactos/subsys/win32k/dib/dib.h b/reactos/subsys/win32k/dib/dib.h index 909c779fa2d..bb61a0f8b47 100644 --- a/reactos/subsys/win32k/dib/dib.h +++ b/reactos/subsys/win32k/dib/dib.h @@ -99,9 +99,6 @@ BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO); BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*,XLATEOBJ*,ULONG); BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG); -#define ROP_USES_SOURCE(Rop4) (((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000)) -#define ROP_USES_PATTERN(Rop4) (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) - extern unsigned char notmask[2]; extern unsigned char altnotmask[2]; #define MASK1BPP(x) (1<<(7-((x)&7))) diff --git a/reactos/subsys/win32k/dib/dib16bpp.c b/reactos/subsys/win32k/dib/dib16bpp.c index a3d54a7d8e1..8b496f86057 100644 --- a/reactos/subsys/win32k/dib/dib16bpp.c +++ b/reactos/subsys/win32k/dib/dib16bpp.c @@ -309,8 +309,8 @@ DIB_16BPP_BitBlt(PBLTINFO BltInfo) PULONG DestBits; ULONG RoundedRight; - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); RoundedRight = BltInfo->DestRect.right - ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x1); diff --git a/reactos/subsys/win32k/dib/dib1bpp.c b/reactos/subsys/win32k/dib/dib1bpp.c index 620e86474b9..8a762e94de6 100644 --- a/reactos/subsys/win32k/dib/dib1bpp.c +++ b/reactos/subsys/win32k/dib/dib1bpp.c @@ -349,8 +349,8 @@ DIB_1BPP_BitBlt(PBLTINFO BltInfo) ULONG RoundedRight; /* BYTE NoBits;*/ - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); RoundedRight = BltInfo->DestRect.right - ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31); diff --git a/reactos/subsys/win32k/dib/dib24bpp.c b/reactos/subsys/win32k/dib/dib24bpp.c index 30a0197bd33..c14dd8230c7 100644 --- a/reactos/subsys/win32k/dib/dib24bpp.c +++ b/reactos/subsys/win32k/dib/dib24bpp.c @@ -244,8 +244,8 @@ DIB_24BPP_BitBlt(PBLTINFO BltInfo) BOOL UsesPattern; PBYTE DestBits; - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); SourceY = BltInfo->SourcePoint.y; DestBits = (PBYTE)( diff --git a/reactos/subsys/win32k/dib/dib32bpp.c b/reactos/subsys/win32k/dib/dib32bpp.c index 1f8f553a815..35a79815b6d 100644 --- a/reactos/subsys/win32k/dib/dib32bpp.c +++ b/reactos/subsys/win32k/dib/dib32bpp.c @@ -293,8 +293,8 @@ DIB_32BPP_BitBlt(PBLTINFO BltInfo) BOOL UsesPattern; PULONG DestBits; - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); SourceY = BltInfo->SourcePoint.y; DestBits = (PULONG)( diff --git a/reactos/subsys/win32k/dib/dib4bpp.c b/reactos/subsys/win32k/dib/dib4bpp.c index c49ad5b089f..db5d57c3c29 100644 --- a/reactos/subsys/win32k/dib/dib4bpp.c +++ b/reactos/subsys/win32k/dib/dib4bpp.c @@ -251,8 +251,8 @@ DIB_4BPP_BitBlt(PBLTINFO BltInfo) 0xFFFFFFFF /* 15 */, }; - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); SourceY = BltInfo->SourcePoint.y; RoundedRight = BltInfo->DestRect.right - diff --git a/reactos/subsys/win32k/dib/dib8bpp.c b/reactos/subsys/win32k/dib/dib8bpp.c index 26d1f4ca65b..d480c7dea6c 100644 --- a/reactos/subsys/win32k/dib/dib8bpp.c +++ b/reactos/subsys/win32k/dib/dib8bpp.c @@ -260,8 +260,8 @@ DIB_8BPP_BitBlt(PBLTINFO BltInfo) PULONG DestBits; LONG RoundedRight; - UsesSource = ROP_USES_SOURCE(BltInfo->Rop4); - UsesPattern = ROP_USES_PATTERN(BltInfo->Rop4); + UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4); + UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4); SourceY = BltInfo->SourcePoint.y; RoundedRight = BltInfo->DestRect.right - diff --git a/reactos/subsys/win32k/eng/bitblt.c b/reactos/subsys/win32k/eng/bitblt.c index c25f97d2976..f3014db5875 100644 --- a/reactos/subsys/win32k/eng/bitblt.c +++ b/reactos/subsys/win32k/eng/bitblt.c @@ -213,7 +213,7 @@ CallDibBitBlt(SURFOBJ* OutputObj, BltInfo.DestRect = *OutputRect; BltInfo.SourcePoint = *InputPoint; - if (Rop4 == SRCCOPY) + if (ROP3_TO_ROP4(SRCCOPY) == Rop4) return DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo); BltInfo.XlatePatternToDest = NULL; @@ -222,7 +222,7 @@ CallDibBitBlt(SURFOBJ* OutputObj, BltInfo.Rop4 = Rop4; /* Pattern brush */ - if (ROP_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF) + if (ROP4_USES_PATTERN(Rop4) && Brush->iSolidColor == 0xFFFFFFFF) { GdiBrush = CONTAINING_RECORD(Brush, GDIBRUSHINST, BrushObject); if((bmPattern = BITMAPOBJ_LockBitmap(GdiBrush->GdiBrushObject->hbmPattern))) @@ -291,9 +291,9 @@ EngBitBlt(SURFOBJ *DestObj, BOOL UsesPattern; POINTL AdjustedBrushOrigin; - UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000); - UsesPattern = ((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000); - if (ROP_NOOP == Rop4) + UsesSource = ROP4_USES_SOURCE(Rop4); + UsesPattern = ROP4_USES_PATTERN(Rop4); + if (R4_NOOP == Rop4) { /* Copy destination onto itself: nop */ return TRUE; @@ -392,20 +392,16 @@ EngBitBlt(SURFOBJ *DestObj, clippingType = ClipRegion->iDComplexity; } - if (0xaacc == Rop4) + if (R4_MASK == Rop4) { BltRectFunc = BltMask; } - else if (PATCOPY == Rop4) + else if (ROP3_TO_ROP4(PATCOPY) == Rop4) { -#if 0 - BltRectFunc = BltPatCopy; -#else if (Brush->iSolidColor == 0xFFFFFFFF) BltRectFunc = CallDibBitBlt; else BltRectFunc = BltPatCopy; -#endif } else { @@ -515,7 +511,7 @@ IntEngBitBlt(BITMAPOBJ *DestObj, InputClippedRect.top = DestRect->bottom; InputClippedRect.bottom = DestRect->top; } - UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000); + UsesSource = ROP4_USES_SOURCE(Rop4); if (UsesSource) { if (NULL == SourcePoint || NULL == SourceSurf) @@ -833,40 +829,41 @@ AlphaBltMask(SURFOBJ* Dest, tMask = Mask->pvScan0 + (SourcePoint->y * Mask->lDelta) + SourcePoint->x; for (j = 0; j < dy; j++) - { - lMask = tMask; - for (i = 0; i < dx; i++) - { - if (*lMask > 0) - { - if(*lMask == 0xff) - { - DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( - Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor); - } - else - { - Background = DIB_GetSource(Dest, DestRect->left + i, DestRect->top + j, SrcColorTranslation); + { + lMask = tMask; + for (i = 0; i < dx; i++) + { + if (*lMask > 0) + { + if (*lMask == 0xff) + { + DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( + Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor); + } + else + { + Background = DIB_GetSource(Dest, DestRect->left + i, DestRect->top + j, + SrcColorTranslation); - NewColor = - RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background), - (*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background), - (*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background)); - - Background = XLATEOBJ_iXlate(ColorTranslation, NewColor); - DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( - Dest, DestRect->left + i, DestRect->top + j, Background); - } - } - lMask++; - } - tMask += Mask->lDelta; - } + NewColor = + RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background), + (*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background), + (*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background)); + + Background = XLATEOBJ_iXlate(ColorTranslation, NewColor); + DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel( + Dest, DestRect->left + i, DestRect->top + j, Background); + } + } + lMask++; + } + tMask += Mask->lDelta; + } return TRUE; } else { - return FALSE; + return FALSE; } } @@ -918,7 +915,7 @@ EngMaskBitBlt(SURFOBJ *DestObj, InputRect.bottom = DestRect->bottom - DestRect->top; } - if (! IntEngEnter(&EnterLeaveSource, NULL, &InputRect, TRUE, &Translate, &InputObj)) + if (! IntEngEnter(&EnterLeaveSource, DestObj, &InputRect, TRUE, &Translate, &InputObj)) { return FALSE; } @@ -1004,7 +1001,8 @@ EngMaskBitBlt(SURFOBJ *DestObj, &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin); else Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation, - &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin, 0xAACC); + &OutputRect, &InputPoint, MaskOrigin, Brush, &AdjustedBrushOrigin, + R4_MASK); break; case DC_RECT: // Clip the blt to the clip rectangle @@ -1020,7 +1018,7 @@ EngMaskBitBlt(SURFOBJ *DestObj, &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin); else Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation, - &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, 0xAACC); + &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, R4_MASK); break; case DC_COMPLEX: Ret = TRUE; @@ -1058,7 +1056,7 @@ EngMaskBitBlt(SURFOBJ *DestObj, &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin) && Ret; else Ret = BltMask(OutputObj, InputObj, Mask, DestColorTranslation, - &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, 0xAACC) && Ret; + &CombinedRect, &Pt, MaskOrigin, Brush, &AdjustedBrushOrigin, R4_MASK) && Ret; } } while(EnumMore); @@ -1069,26 +1067,20 @@ EngMaskBitBlt(SURFOBJ *DestObj, IntEngLeave(&EnterLeaveDest); IntEngLeave(&EnterLeaveSource); - /* Dummy BitBlt to let driver know that something has changed. - 0x00AA0029 is the Rop for D (no-op) */ - /* FIXME: Remove the typecast! */ - IntEngBitBlt((BITMAPOBJ*)DestObj, NULL, (BITMAPOBJ*)Mask, ClipRegion, DestColorTranslation, - DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, ROP_NOOP); - return Ret; } BOOL STDCALL IntEngMaskBlt(SURFOBJ *DestObj, - SURFOBJ *Mask, - CLIPOBJ *ClipRegion, - XLATEOBJ *DestColorTranslation, - XLATEOBJ *SourceColorTranslation, - RECTL *DestRect, - POINTL *SourcePoint, - POINTL *MaskOrigin, - BRUSHOBJ *Brush, - POINTL *BrushOrigin) + SURFOBJ *Mask, + CLIPOBJ *ClipRegion, + XLATEOBJ *DestColorTranslation, + XLATEOBJ *SourceColorTranslation, + RECTL *DestRect, + POINTL *SourcePoint, + POINTL *MaskOrigin, + BRUSHOBJ *Brush, + POINTL *BrushOrigin) { BOOLEAN ret; RECTL OutputRect; @@ -1123,9 +1115,21 @@ IntEngMaskBlt(SURFOBJ *DestObj, MouseSafetyOnDrawStart(DestObj, OutputRect.left, OutputRect.top, OutputRect.right, OutputRect.bottom); + /* Dummy BitBlt to let driver know that it should flush its changes. + This should really be done using a call to DrvSynchronizeSurface, + but the VMware driver doesn't hook that call. */ + /* FIXME: Remove the typecast! */ + IntEngBitBlt((BITMAPOBJ*)DestObj, NULL, (BITMAPOBJ*)Mask, ClipRegion, DestColorTranslation, + DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, R4_NOOP); + ret = EngMaskBitBlt(DestObj, Mask, ClipRegion, DestColorTranslation, SourceColorTranslation, &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin); + /* Dummy BitBlt to let driver know that something has changed. */ + /* FIXME: Remove the typecast! */ + IntEngBitBlt((BITMAPOBJ*)DestObj, NULL, (BITMAPOBJ*)Mask, ClipRegion, DestColorTranslation, + DestRect, SourcePoint, MaskOrigin, Brush, BrushOrigin, R4_NOOP); + MouseSafetyOnDrawEnd(DestObj); return ret; diff --git a/reactos/subsys/win32k/eng/copybits.c b/reactos/subsys/win32k/eng/copybits.c index cfc4266aea4..d1f9b0767a1 100644 --- a/reactos/subsys/win32k/eng/copybits.c +++ b/reactos/subsys/win32k/eng/copybits.c @@ -98,7 +98,7 @@ EngCopyBits(SURFOBJ *Dest, /* FIXME: Remove the typecast! */ ret = IntEngBitBlt((BITMAPOBJ*)Dest, (BITMAPOBJ*)Source, NULL, Clip, ColorTranslation, DestRect, SourcePoint, - NULL, NULL, NULL, 0); + NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY)); MouseSafetyOnDrawEnd(Dest); MouseSafetyOnDrawEnd(Source); diff --git a/reactos/subsys/win32k/eng/gradient.c b/reactos/subsys/win32k/eng/gradient.c index 9ccbe20de3f..471a4d50e1f 100644 --- a/reactos/subsys/win32k/eng/gradient.c +++ b/reactos/subsys/win32k/eng/gradient.c @@ -541,7 +541,7 @@ IntEngGradientFill( pco->rclBounds.top, pco->rclBounds.right, pco->rclBounds.bottom); - if((psoDest->iType != STYPE_BITMAP) && (pboDest->flHooks & HOOK_GRADIENTFILL)) + if(pboDest->flHooks & HOOK_GRADIENTFILL) { Ret = GDIDEVFUNCS(psoDest).GradientFill( psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, @@ -551,19 +551,6 @@ IntEngGradientFill( } Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents, pptlDitherOrg, ulMode); - if(Ret) - { - /* Dummy BitBlt to let driver know that something has changed. - 0x00AA0029 is the Rop for D (no-op) */ - if(pboDest->flHooks & HOOK_BITBLT) - { - GDIDEVFUNCS(psoDest).BitBlt( - psoDest, NULL, NULL, pco, pxlo, - prclExtents, pptlDitherOrg, NULL, NULL, NULL, ROP_NOOP); - MouseSafetyOnDrawEnd(psoDest); - return TRUE; - } - } MouseSafetyOnDrawEnd(psoDest); return Ret; } diff --git a/reactos/subsys/win32k/eng/mouse.c b/reactos/subsys/win32k/eng/mouse.c index 9d3ab01a73e..57c7c7d1801 100644 --- a/reactos/subsys/win32k/eng/mouse.c +++ b/reactos/subsys/win32k/eng/mouse.c @@ -178,7 +178,7 @@ IntHideMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface) if((MaskSurface = EngLockSurface(pgp->MaskSurface))) { EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL, - &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY); + &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, ROP3_TO_ROP4(SRCCOPY)); EngUnlockSurface(MaskSurface); } EngUnlockSurface(SaveSurface); @@ -231,7 +231,7 @@ IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface) DestSurface->sizlBitmap.cy - pt.y); EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL, - &DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY); + &DestRect, &SrcPoint, NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY)); EngUnlockSurface(SaveSurface); } @@ -265,17 +265,17 @@ IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface) if((ColorSurf = EngLockSurface(pgp->ColorSurface))) { EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, pgp->XlateObject, - &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC); + &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, R4_MASK); EngUnlockSurface(ColorSurf); } } else { EngBitBlt(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject, - &DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND); + &DestRect, &SrcPoint, NULL, NULL, NULL, ROP3_TO_ROP4(SRCAND)); SrcPoint.y += pgp->Size.cy; EngBitBlt(DestSurface, MaskSurf, NULL, NULL, pgp->XlateObject, - &DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT); + &DestRect, &SrcPoint, NULL, NULL, NULL, ROP3_TO_ROP4(SRCINVERT)); } EngUnlockSurface(MaskSurf); } diff --git a/reactos/subsys/win32k/eng/transblt.c b/reactos/subsys/win32k/eng/transblt.c index 3bc46c2a7d1..ede7a478f74 100644 --- a/reactos/subsys/win32k/eng/transblt.c +++ b/reactos/subsys/win32k/eng/transblt.c @@ -270,18 +270,6 @@ IntEngTransparentBlt(BITMAPOBJ *DestObj, &OutputRect, SourceRect, iTransColor, Reserved); } - if(Ret) - { - /* Dummy BitBlt to let driver know that something has changed. - 0x00AA0029 is the Rop for D (no-op) */ - if (DestObj->flHooks & HOOK_BITBLT) - { - GDIDEVFUNCS(DestSurf).BitBlt( - DestSurf, NULL, NULL, Clip, ColorTranslation, - &OutputRect, NULL, NULL, NULL, NULL, ROP_NOOP); - } - } - MouseSafetyOnDrawEnd(DestSurf); if(SourceSurf != DestSurf) { diff --git a/reactos/subsys/win32k/include/inteng.h b/reactos/subsys/win32k/include/inteng.h index 63e31a7ce4c..11d1875f9b9 100644 --- a/reactos/subsys/win32k/include/inteng.h +++ b/reactos/subsys/win32k/include/inteng.h @@ -18,7 +18,17 @@ typedef struct tagSPAN ULONG Width; } SPAN, *PSPAN; -#define ROP_NOOP 0x00AA0029 +#define R3_OPINDEX_SRCCOPY 0xcc +#define R3_OPINDEX_NOOP 0xaa +#define R4_NOOP ((R3_OPINDEX_NOOP << 8) | R3_OPINDEX_NOOP) +#define R4_MASK ((R3_OPINDEX_NOOP << 8) | R3_OPINDEX_SRCCOPY) + +#define ROP2_TO_MIX(Rop2) (((Rop2) << 8) | (Rop2)) +#define ROP3_USES_SOURCE(Rop3) ((((Rop3) & 0xCC0000) >> 2) != ((Rop3) & 0x330000)) +#define ROP4_USES_SOURCE(Rop4) (((((Rop4) & 0xCC) >> 2) != ((Rop4) & 0x33)) || ((((Rop4) & 0xCC00) >> 2) != ((Rop4) & 0x3300))) +#define ROP3_USES_PATTERN(Rop3) ((((Rop3) & 0xF00000) >> 4) != ((Rop3) & 0x0F0000)) +#define ROP4_USES_PATTERN(Rop4) (((((Rop4) & 0xF0) >> 4) != ((Rop4) & 0x0F)) || ((((Rop4) & 0xF000) >> 4) != ((Rop4) & 0x0F00))) +#define ROP3_TO_ROP4(Rop3) ((((Rop3) >> 8) & 0xff00) | (((Rop3) >> 16) & 0x00ff)) /* Definitions of IntEngXxx functions */ @@ -32,7 +42,6 @@ VOID FASTCALL IntEngCleanupDriverObjs(struct _EPROCESS *Process, PW32PROCESS Win32Process); -#define ROP2_TO_MIX(Rop2) (((Rop2) << 8) | (Rop2)) BOOL STDCALL IntEngLineTo(BITMAPOBJ *Surface, CLIPOBJ *Clip, diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index 74490b93c1a..31b7ff80f36 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -49,8 +49,8 @@ NtGdiBitBlt( HPALETTE SourcePalette = 0, DestPalette = 0; PGDIBRUSHOBJ BrushObj; GDIBRUSHINST BrushInst; - BOOL UsesSource = ROP_USES_SOURCE(ROP); - BOOL UsesPattern = ROP_USES_PATTERN(ROP); + BOOL UsesSource = ROP3_USES_SOURCE(ROP); + BOOL UsesPattern = ROP3_USES_PATTERN(ROP); DCDest = DC_LockDc(hDCDest); if (NULL == DCDest) @@ -201,7 +201,8 @@ NtGdiBitBlt( /* Perform the bitblt operation */ Status = IntEngBitBlt(BitmapDest, BitmapSrc, NULL, DCDest->CombinedClip, XlateObj, - &DestRect, &SourcePoint, NULL, BrushObj ? &BrushInst.BrushObject : NULL, &BrushOrigin, ROP); + &DestRect, &SourcePoint, NULL, BrushObj ? &BrushInst.BrushObject : NULL, + &BrushOrigin, ROP3_TO_ROP4(ROP)); if (UsesSource && XlateObj != NULL) EngDeleteXlate(XlateObj); diff --git a/reactos/subsys/win32k/objects/brush.c b/reactos/subsys/win32k/objects/brush.c index 5d9011fd1dd..a14fb5a1efa 100644 --- a/reactos/subsys/win32k/objects/brush.c +++ b/reactos/subsys/win32k/objects/brush.c @@ -239,7 +239,7 @@ IntPatBlt( NULL, &BrushInst.BrushObject, &BrushOrigin, - ROP); + ROP3_TO_ROP4(ROP)); } BITMAPOBJ_UnlockBitmap(dc->w.hBitmap); diff --git a/reactos/subsys/win32k/objects/fillshap.c b/reactos/subsys/win32k/objects/fillshap.c index 3c9ef6e7e35..066cf2204fe 100644 --- a/reactos/subsys/win32k/objects/fillshap.c +++ b/reactos/subsys/win32k/objects/fillshap.c @@ -979,7 +979,7 @@ IntRectangle(PDC dc, NULL, &FillBrushInst.BrushObject, NULL, - PATCOPY); + ROP3_TO_ROP4(PATCOPY)); } } diff --git a/reactos/subsys/win32k/objects/text.c b/reactos/subsys/win32k/objects/text.c index cc49e03fa21..02f7c13cb45 100644 --- a/reactos/subsys/win32k/objects/text.c +++ b/reactos/subsys/win32k/objects/text.c @@ -1636,7 +1636,7 @@ NtGdiExtTextOut( &SourcePoint, &BrushBgInst.BrushObject, &BrushOrigin, - PATCOPY); + ROP3_TO_ROP4(PATCOPY)); fuOptions &= ~ETO_OPAQUE; } else @@ -1854,7 +1854,7 @@ NtGdiExtTextOut( &SourcePoint, &BrushBgInst.BrushObject, &BrushOrigin, - PATCOPY); + ROP3_TO_ROP4(PATCOPY)); BackgroundLeft = DestRect.right; }