mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NtGdi] Fix clip region merging.
Use a new region while merging from the original. See CORE-16626.
This commit is contained in:
parent
367a94211b
commit
4927905eeb
1 changed files with 26 additions and 61 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue