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