Author: tkreuzer Date: Wed Feb 11 21:35:09 2015 New Revision: 66230
URL: http://svn.reactos.org/svn/reactos?rev=66230&view=rev Log: [WIN32K] Fix handling of mask bitmap in NtGdiMaskBlt
Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
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] Wed Feb 11 21:35:09 2015 @@ -324,51 +324,44 @@ BOOL Status = FALSE; EXLATEOBJ exlo; XLATEOBJ *XlateObj = NULL; - BOOL UsesSource = ROP_USES_SOURCE(dwRop); - BOOL UsesMask; - - FIXUP_ROP(dwRop); - - UsesMask = ROP_USES_MASK(dwRop); + BOOL UsesSource; + + 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) - { - WARN("Getting Mask bitmap without needing it?\n"); - SURFACE_ShareUnlockSurface(psurfMask); + else + { + /* 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;