Fix NtGdiPatBlt: ROPs with a source are not allowed, the background ROP is simply ignored.

svn path=/trunk/; revision=56428
This commit is contained in:
Timo Kreuzer 2012-04-26 09:42:46 +00:00
parent 416711ec61
commit eb00489bf8

View file

@ -866,53 +866,60 @@ IntGdiPolyPatBlt(
return TRUE; return TRUE;
} }
BOOL APIENTRY BOOL
APIENTRY
NtGdiPatBlt( NtGdiPatBlt(
HDC hDC, _In_ HDC hdcDest,
INT XLeft, _In_ INT x,
INT YLeft, _In_ INT y,
INT Width, _In_ INT cx,
INT Height, _In_ INT cy,
DWORD ROP) _In_ DWORD rop4)
{ {
DC *dc; BOOL bResult;
PDC_ATTR pdcattr; PDC pdc;
BOOL ret;
BOOL UsesSource = ROP_USES_SOURCE(ROP); /* Mask away everything except foreground rop index */
if (UsesSource) rop4 = rop4 & 0x00FF0000;
rop4 |= rop4 << 8;
/* Check if the rop uses a source */
if (ROP_USES_SOURCE(rop4))
{ {
/* In this case we call on GdiMaskBlt */ /* This is not possible */
return NtGdiMaskBlt(hDC, XLeft, YLeft, Width, Height, 0,0,0,0,0,0,ROP,0); return 0;
} }
dc = DC_LockDc(hDC); /* Lock the DC */
if (dc == NULL) pdc = DC_LockDc(hdcDest);
if (pdc == NULL)
{ {
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->dctype == DC_TYPE_INFO)
/* Check if the DC has no surface (empty mem or info DC) */
if (pdc->dclevel.pSurface == NULL)
{ {
DC_UnlockDc(dc); /* Nothing to do, Windows returns TRUE! */
DPRINT1("NtGdiPatBlt on info DC!\n"); DC_UnlockDc(pdc);
/* Yes, Windows really returns TRUE in this case */
return TRUE; return TRUE;
} }
pdcattr = dc->pdcattr; /* Update the fill brush, if neccessary */
if (pdc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
DC_vUpdateFillBrush(pdc);
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)) /* Call the internal function */
DC_vUpdateFillBrush(dc); bResult = IntPatBlt(pdc, x, y, cx, cy, rop4, &pdc->eboFill);
ret = IntPatBlt(dc, XLeft, YLeft, Width, Height, ROP, &dc->eboFill); /* Unlock the DC and return the result */
DC_UnlockDc(pdc);
DC_UnlockDc(dc); return bResult;
return ret;
} }
BOOL APIENTRY BOOL
APIENTRY
NtGdiPolyPatBlt( NtGdiPolyPatBlt(
HDC hDC, HDC hDC,
DWORD dwRop, DWORD dwRop,