Fix handling of mask bitmap in NtGdiMaskBlt

svn path=/trunk/; revision=66230
This commit is contained in:
Timo Kreuzer 2015-02-11 21:35:09 +00:00
parent ab543f2e54
commit 88cc747e0b

View file

@ -324,51 +324,44 @@ NtGdiMaskBlt(
BOOL Status = FALSE; BOOL Status = FALSE;
EXLATEOBJ exlo; EXLATEOBJ exlo;
XLATEOBJ *XlateObj = NULL; XLATEOBJ *XlateObj = NULL;
BOOL UsesSource = ROP_USES_SOURCE(dwRop); BOOL UsesSource;
BOOL UsesMask;
FIXUP_ROP(dwRop); FIXUP_ROP(dwRop); // FIXME: why do we need this???
UsesMask = ROP_USES_MASK(dwRop);
//DPRINT1("dwRop : 0x%08x\n", dwRop); //DPRINT1("dwRop : 0x%08x\n", dwRop);
UsesSource = ROP_USES_SOURCE(dwRop);
if (!hdcDest || (UsesSource && !hdcSrc)) if (!hdcDest || (UsesSource && !hdcSrc))
{ {
EngSetLastError(ERROR_INVALID_PARAMETER); EngSetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
/* Take care of mask bitmap */ /* Check if we need a mask and have a mask bitmap */
if(hbmMask) if (ROP_USES_MASK(dwRop) && (hbmMask != NULL))
{ {
/* Reference the mask bitmap */
psurfMask = SURFACE_ShareLockSurface(hbmMask); psurfMask = SURFACE_ShareLockSurface(hbmMask);
if(!psurfMask) if (psurfMask == NULL)
{ {
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
}
if(UsesMask) /* Make sure the mask bitmap is 1 BPP */
{ if (gajBitsPerFormat[psurfMask->SurfObj.iBitmapFormat] != 1)
if(!psurfMask)
{
EngSetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(gajBitsPerFormat[psurfMask->SurfObj.iBitmapFormat] != 1)
{ {
EngSetLastError(ERROR_INVALID_PARAMETER); EngSetLastError(ERROR_INVALID_PARAMETER);
SURFACE_ShareUnlockSurface(psurfMask); SURFACE_ShareUnlockSurface(psurfMask);
return FALSE; return FALSE;
} }
} }
else if(psurfMask) else
{ {
WARN("Getting Mask bitmap without needing it?\n"); /* We use NULL, if we need a mask, the Eng function will take care of
SURFACE_ShareUnlockSurface(psurfMask); that and use the brushobject to get a mask */
psurfMask = NULL; psurfMask = NULL;
} }
MaskPoint.x = xMask; MaskPoint.x = xMask;
MaskPoint.y = yMask; MaskPoint.y = yMask;