mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:15:43 +00:00
[WIN32K]
- Remove useless offset part in REGION_CropAndOffsetRegion svn path=/trunk/; revision=65722
This commit is contained in:
parent
4fa10c7ef9
commit
163de23b57
3 changed files with 99 additions and 163 deletions
|
@ -294,10 +294,9 @@ NtGdiIntersectClipRect(
|
|||
if (pdc->dclevel.prgnClip != NULL)
|
||||
{
|
||||
/* We have a region, crop it */
|
||||
iComplexity = REGION_CropAndOffsetRegion(pdc->dclevel.prgnClip,
|
||||
iComplexity = REGION_CropRegion(pdc->dclevel.prgnClip,
|
||||
pdc->dclevel.prgnClip,
|
||||
&rect,
|
||||
NULL);
|
||||
&rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -601,79 +601,10 @@ REGION_SetExtents(
|
|||
*/
|
||||
INT
|
||||
FASTCALL
|
||||
REGION_CropAndOffsetRegion(
|
||||
REGION_CropRegion(
|
||||
PREGION rgnDst,
|
||||
PREGION rgnSrc,
|
||||
const RECTL *rect,
|
||||
const POINTL *offset) // FIXME: we should probably remove offset from here
|
||||
{
|
||||
POINT pt = {0,0};
|
||||
const POINT *off = offset;
|
||||
|
||||
if (off == NULL)
|
||||
off = &pt;
|
||||
|
||||
/* Just copy and offset */
|
||||
if (rect == NULL)
|
||||
{
|
||||
PRECTL xrect;
|
||||
|
||||
if (rgnDst == rgnSrc)
|
||||
{
|
||||
if (off->x || off->y)
|
||||
xrect = rgnDst->Buffer;
|
||||
else
|
||||
return REGION_Complexity(rgnDst);
|
||||
}
|
||||
else
|
||||
{
|
||||
xrect = ExAllocatePoolWithTag(PagedPool,
|
||||
rgnSrc->rdh.nCount * sizeof(RECT),
|
||||
TAG_REGION);
|
||||
if (xrect == NULL)
|
||||
return ERROR;
|
||||
|
||||
/* Free the old buffer. Will be assigned to xrect below. */
|
||||
if (rgnDst->Buffer && (rgnDst->Buffer != &rgnDst->rdh.rcBound))
|
||||
ExFreePoolWithTag(rgnDst->Buffer, TAG_REGION);
|
||||
}
|
||||
|
||||
if (rgnDst != rgnSrc)
|
||||
{
|
||||
*rgnDst = *rgnSrc;
|
||||
}
|
||||
|
||||
if (off->x || off->y)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < rgnDst->rdh.nCount; i++)
|
||||
{
|
||||
xrect[i].left = (rgnSrc->Buffer + i)->left + off->x;
|
||||
xrect[i].right = (rgnSrc->Buffer + i)->right + off->x;
|
||||
xrect[i].top = (rgnSrc->Buffer + i)->top + off->y;
|
||||
xrect[i].bottom = (rgnSrc->Buffer + i)->bottom + off->y;
|
||||
}
|
||||
|
||||
rgnDst->rdh.rcBound.left += off->x;
|
||||
rgnDst->rdh.rcBound.right += off->x;
|
||||
rgnDst->rdh.rcBound.top += off->y;
|
||||
rgnDst->rdh.rcBound.bottom += off->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
COPY_RECTS(xrect, rgnSrc->Buffer, rgnDst->rdh.nCount);
|
||||
}
|
||||
|
||||
rgnDst->Buffer = xrect;
|
||||
}
|
||||
else if ((rect->left >= rect->right) ||
|
||||
(rect->top >= rect->bottom) ||
|
||||
(EXTENTCHECK(rect, &rgnSrc->rdh.rcBound) == 0))
|
||||
{
|
||||
goto empty;
|
||||
}
|
||||
else // Region box and clipping rect appear to intersect
|
||||
const RECTL *rect)
|
||||
{
|
||||
PRECTL lpr, rpr;
|
||||
ULONG i, j, clipa, clipb, nRgnSize;
|
||||
|
@ -682,6 +613,13 @@ REGION_CropAndOffsetRegion(
|
|||
INT top = MAXLONG;
|
||||
INT bottom = MINLONG;
|
||||
|
||||
if ((rect->left >= rect->right) ||
|
||||
(rect->top >= rect->bottom) ||
|
||||
(EXTENTCHECK(rect, &rgnSrc->rdh.rcBound) == 0))
|
||||
{
|
||||
goto empty;
|
||||
}
|
||||
|
||||
/* Skip all rects that are completely above our intersect rect */
|
||||
for (clipa = 0; clipa < rgnSrc->rdh.nCount; clipa++)
|
||||
{
|
||||
|
@ -728,7 +666,7 @@ REGION_CropAndOffsetRegion(
|
|||
/* Loop all rects within the intersect rect from the y perspective */
|
||||
for (i = clipa, j = 0; i < clipb ; i++)
|
||||
{
|
||||
// i - src index, j - dst index, j is always <= i for obvious reasons
|
||||
/* i - src index, j - dst index, j is always <= i for obvious reasons */
|
||||
|
||||
lpr = &rgnSrc->Buffer[i];
|
||||
|
||||
|
@ -746,10 +684,10 @@ REGION_CropAndOffsetRegion(
|
|||
rpr = &rgnDst->Buffer[j];
|
||||
|
||||
/* Crop the rect with the intersect rect and add offset */
|
||||
rpr->top = max(lpr->top, rect->top) + off->y;
|
||||
rpr->bottom = min(lpr->bottom, rect->bottom) + off->y;
|
||||
rpr->left = max(lpr->left, rect->left) + off->x;
|
||||
rpr->right = min(lpr->right, rect->right) + off->y;
|
||||
rpr->top = max(lpr->top, rect->top);
|
||||
rpr->bottom = min(lpr->bottom, rect->bottom);
|
||||
rpr->left = max(lpr->left, rect->left);
|
||||
rpr->right = min(lpr->right, rect->right);
|
||||
|
||||
/* Make sure the resulting rect is not retarded */
|
||||
ASSERT(lpr->bottom > rect->top);
|
||||
|
@ -776,7 +714,6 @@ REGION_CropAndOffsetRegion(
|
|||
|
||||
/* Set new rect count */
|
||||
rgnDst->rdh.nCount = j;
|
||||
}
|
||||
|
||||
return REGION_Complexity(rgnDst);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ INT FASTCALL REGION_SubtractRectFromRgn(PREGION prgnDest, PREGION prgnSrc, const
|
|||
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, RECTL *pRect);
|
||||
BOOL FASTCALL REGION_RectInRegion(PREGION Rgn, const RECTL *rc);
|
||||
BOOL FASTCALL REGION_PtInRegion(PREGION, INT, INT);
|
||||
INT FASTCALL REGION_CropAndOffsetRegion(PREGION rgnDst, PREGION rgnSrc, const RECTL *rect, const POINT *off);
|
||||
INT FASTCALL REGION_CropRegion(PREGION rgnDst, PREGION rgnSrc, const RECTL *rect);
|
||||
VOID FASTCALL REGION_SetRectRgn(PREGION pRgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect);
|
||||
VOID NTAPI REGION_vCleanup(PVOID ObjectBody);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue