From 88cc747e0b75868397cf565cc76c9d721cd13323 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 11 Feb 2015 21:35:09 +0000 Subject: [PATCH] [WIN32K] Fix handling of mask bitmap in NtGdiMaskBlt svn path=/trunk/; revision=66230 --- reactos/win32ss/gdi/ntgdi/bitblt.c | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index a0b07248918..935197948f3 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -324,51 +324,44 @@ NtGdiMaskBlt( BOOL Status = FALSE; EXLATEOBJ exlo; XLATEOBJ *XlateObj = NULL; - BOOL UsesSource = ROP_USES_SOURCE(dwRop); - BOOL UsesMask; + BOOL UsesSource; - FIXUP_ROP(dwRop); - - UsesMask = ROP_USES_MASK(dwRop); + FIXUP_ROP(dwRop); // FIXME: why do we need this??? //DPRINT1("dwRop : 0x%08x\n", dwRop); + UsesSource = ROP_USES_SOURCE(dwRop); if (!hdcDest || (UsesSource && !hdcSrc)) { EngSetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - /* Take care of mask bitmap */ - if(hbmMask) + /* Check if we need a mask and have a mask bitmap */ + if (ROP_USES_MASK(dwRop) && (hbmMask != NULL)) { + /* Reference the mask bitmap */ psurfMask = SURFACE_ShareLockSurface(hbmMask); - if(!psurfMask) + if (psurfMask == NULL) { EngSetLastError(ERROR_INVALID_HANDLE); return FALSE; } - } - if(UsesMask) - { - if(!psurfMask) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - if(gajBitsPerFormat[psurfMask->SurfObj.iBitmapFormat] != 1) + /* Make sure the mask bitmap is 1 BPP */ + if (gajBitsPerFormat[psurfMask->SurfObj.iBitmapFormat] != 1) { EngSetLastError(ERROR_INVALID_PARAMETER); SURFACE_ShareUnlockSurface(psurfMask); return FALSE; } } - else if(psurfMask) + else { - WARN("Getting Mask bitmap without needing it?\n"); - SURFACE_ShareUnlockSurface(psurfMask); + /* We use NULL, if we need a mask, the Eng function will take care of + that and use the brushobject to get a mask */ psurfMask = NULL; } + MaskPoint.x = xMask; MaskPoint.y = yMask;