[0.4.13][NTGDI] Fix regression CORE-16626

This will fix symptom "MPC HC 1.7.13 does not draw
part of its GUI anymore"

Fix clip region merging.
Use a new region while merging from the original.

The regression has been introduced by 0.4.13-dev-208-g
94b4b5c127

Fixing it today for RC means, we had not a single affected
official ros release.

cherry picked from commit 0.4.14-dev-830-g
4927905eeb
This commit is contained in:
James Tabor 2020-01-20 12:49:11 -06:00 committed by Joachim Henze
parent 3862cc6f03
commit 63f46f3fde

View file

@ -145,12 +145,12 @@ IntSelectClipRgn(
} }
} }
//EngReleaseSemaphore(pdc->ppdev->hsemDevLock); //EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
#if 0
rcl.left += dc->ptlDCOrig.x; rcl.left += dc->ptlDCOrig.x;
rcl.top += dc->ptlDCOrig.y; rcl.top += dc->ptlDCOrig.y;
rcl.right += dc->ptlDCOrig.x; rcl.right += dc->ptlDCOrig.x;
rcl.bottom += dc->ptlDCOrig.y; rcl.bottom += dc->ptlDCOrig.y;
#endif
prgnClip = IntSysCreateRectpRgnIndirect(&rcl); prgnClip = IntSysCreateRectpRgnIndirect(&rcl);
Ret = IntGdiCombineRgn(prgnNClip, prgnClip, prgn, fnMode); Ret = IntGdiCombineRgn(prgnNClip, prgnClip, prgn, fnMode);
@ -439,9 +439,10 @@ NtGdiExcludeClipRect(
_In_ INT xRight, _In_ INT xRight,
_In_ INT yBottom) _In_ INT yBottom)
{ {
INT iComplexity; INT iComplexity = ERROR;
RECTL rect; RECTL rect;
PDC pdc; PDC pdc;
PREGION prgn;
/* Lock the DC */ /* Lock the DC */
pdc = DC_LockDc(hdc); pdc = DC_LockDc(hdc);
@ -452,46 +453,25 @@ NtGdiExcludeClipRect(
} }
/* Convert coordinates to device space */ /* Convert coordinates to device space */
rect.left = xLeft; rect.left = xLeft;
rect.top = yTop; rect.top = yTop;
rect.right = xRight; rect.right = xRight;
rect.bottom = yBottom; rect.bottom = yBottom;
RECTL_vMakeWellOrdered(&rect); RECTL_vMakeWellOrdered(&rect);
IntLPtoDP(pdc, (LPPOINT)&rect, 2); IntLPtoDP(pdc, (LPPOINT)&rect, 2);
/* Check if we already have a clip region */ prgn = IntSysCreateRectpRgnIndirect(&rect);
if (pdc->dclevel.prgnClip != NULL) if ( prgn )
{ {
/* We have a region, subtract the rect */ iComplexity = IntSelectClipRgn( pdc, prgn, RGN_DIFF );
iComplexity = REGION_SubtractRectFromRgn(pdc->dclevel.prgnClip,
pdc->dclevel.prgnClip, REGION_Delete(prgn);
&rect);
}
else
{
/* We don't have a clip region yet, create an empty region */
pdc->dclevel.prgnClip = IntSysCreateRectpRgn(0, 0, 0, 0);
if (pdc->dclevel.prgnClip == NULL)
{
iComplexity = ERROR;
}
else
{
/* Subtract the rect from the VIS region */
iComplexity = REGION_SubtractRectFromRgn(pdc->dclevel.prgnClip,
pdc->prgnVis,
&rect);
}
} }
/* Emulate Windows behavior */ /* Emulate Windows behavior */
if (iComplexity == SIMPLEREGION) if (iComplexity == SIMPLEREGION)
iComplexity = COMPLEXREGION; iComplexity = COMPLEXREGION;
/* If we succeeded, mark the RAO region as dirty */
if (iComplexity != ERROR)
pdc->fs |= DC_FLAG_DIRTY_RAO;
/* Unlock the DC */ /* Unlock the DC */
DC_UnlockDc(pdc); DC_UnlockDc(pdc);
@ -507,10 +487,10 @@ NtGdiIntersectClipRect(
_In_ INT xRight, _In_ INT xRight,
_In_ INT yBottom) _In_ INT yBottom)
{ {
INT iComplexity; INT iComplexity = ERROR;
RECTL rect; RECTL rect;
PREGION prgnNew;
PDC pdc; PDC pdc;
PREGION prgn;
DPRINT("NtGdiIntersectClipRect(%p, %d,%d-%d,%d)\n", DPRINT("NtGdiIntersectClipRect(%p, %d,%d-%d,%d)\n",
hdc, xLeft, yTop, xRight, yBottom); hdc, xLeft, yTop, xRight, yBottom);
@ -524,39 +504,24 @@ NtGdiIntersectClipRect(
} }
/* Convert coordinates to device space */ /* Convert coordinates to device space */
rect.left = xLeft; rect.left = xLeft;
rect.top = yTop; rect.top = yTop;
rect.right = xRight; rect.right = xRight;
rect.bottom = yBottom; rect.bottom = yBottom;
RECTL_vMakeWellOrdered(&rect);
IntLPtoDP(pdc, (LPPOINT)&rect, 2); IntLPtoDP(pdc, (LPPOINT)&rect, 2);
/* Check if we already have a clip region */ prgn = IntSysCreateRectpRgnIndirect(&rect);
if (pdc->dclevel.prgnClip != NULL) if ( prgn )
{ {
/* We have a region, crop it */ iComplexity = IntSelectClipRgn( pdc, prgn, RGN_AND );
iComplexity = REGION_CropRegion(pdc->dclevel.prgnClip,
pdc->dclevel.prgnClip, REGION_Delete(prgn);
&rect);
}
else
{
/* We don't have a region yet, allocate a new one */
prgnNew = IntSysCreateRectpRgnIndirect(&rect);
if (prgnNew == NULL)
{
iComplexity = ERROR;
}
else
{
/* Set the new region */
pdc->dclevel.prgnClip = prgnNew;
iComplexity = SIMPLEREGION;
}
} }
/* If we succeeded, mark the RAO region as dirty */ /* Emulate Windows behavior */
if (iComplexity != ERROR) if ( iComplexity == SIMPLEREGION )
pdc->fs |= DC_FLAG_DIRTY_RAO; iComplexity = COMPLEXREGION;
/* Unlock the DC */ /* Unlock the DC */
DC_UnlockDc(pdc); DC_UnlockDc(pdc);