mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 00:31:27 +00:00
Create Int versions of Rect functions
svn path=/trunk/; revision=11674
This commit is contained in:
parent
ccc0695954
commit
22e0d4d8eb
6 changed files with 272 additions and 68 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: gradient.c,v 1.10 2004/07/03 13:55:35 navaraf Exp $
|
/* $Id: gradient.c,v 1.11 2004/11/15 23:10:41 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -119,7 +119,7 @@ IntEngGradientFillRect(
|
||||||
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
||||||
{
|
{
|
||||||
if(NtGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
if(IntGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
||||||
{
|
{
|
||||||
HVINITCOL(Red, 0);
|
HVINITCOL(Red, 0);
|
||||||
HVINITCOL(Green, 1);
|
HVINITCOL(Green, 1);
|
||||||
|
@ -147,7 +147,7 @@ IntEngGradientFillRect(
|
||||||
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
||||||
{
|
{
|
||||||
if(NtGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
if(IntGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
||||||
{
|
{
|
||||||
HVINITCOL(Red, 0);
|
HVINITCOL(Red, 0);
|
||||||
HVINITCOL(Green, 1);
|
HVINITCOL(Green, 1);
|
||||||
|
@ -183,7 +183,7 @@ IntEngGradientFillRect(
|
||||||
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
|
||||||
{
|
{
|
||||||
if(NtGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
if(IntGdiIntersectRect(&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)&rcSG))
|
||||||
{
|
{
|
||||||
for(; FillRect.top < FillRect.bottom; FillRect.top++)
|
for(; FillRect.top < FillRect.bottom; FillRect.top++)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@ IntEngGradientFillTriangle(
|
||||||
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
|
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
|
||||||
{
|
{
|
||||||
if(NtGdiIntersectRect((PRECT)&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)prclExtents))
|
if(IntGdiIntersectRect((PRECT)&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)prclExtents))
|
||||||
{
|
{
|
||||||
BOOL InY;
|
BOOL InY;
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ IntEngGradientFillTriangle(
|
||||||
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
|
||||||
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
|
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
|
||||||
{
|
{
|
||||||
if(NtGdiIntersectRect((PRECT)&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)prclExtents))
|
if(IntGdiIntersectRect((PRECT)&FillRect, (PRECT)&RectEnum.arcl[i], (PRECT)prclExtents))
|
||||||
{
|
{
|
||||||
S_INITLINE(v1, v3, 0);
|
S_INITLINE(v1, v3, 0);
|
||||||
S_INITLINE(v1, v2, 1);
|
S_INITLINE(v1, v2, 1);
|
||||||
|
|
|
@ -145,5 +145,25 @@ IntGdiCombineTransform(LPXFORM XFormResult,
|
||||||
LPXFORM xform1,
|
LPXFORM xform1,
|
||||||
LPXFORM xform2);
|
LPXFORM xform2);
|
||||||
|
|
||||||
|
/* RECT functions */
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntGdiSetRect(PRECT Rect, INT left, INT top, INT right, INT bottom);
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntGdiSetEmptyRect(PRECT Rect);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiIsEmptyRect(const RECT* Rect);
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntGdiOffsetRect(LPRECT Rect, INT x, INT y);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2);
|
||||||
|
|
||||||
#endif /* _WIN32K_INTGDI_H */
|
#endif /* _WIN32K_INTGDI_H */
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Id: painting.c,v 1.86 2004/09/28 15:02:30 weiden Exp $
|
* $Id: painting.c,v 1.87 2004/11/15 23:10:42 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -695,7 +695,7 @@ IntFixCaret(HWND hWnd, LPRECT lprc, UINT flags)
|
||||||
rcCaret.top = pt.y;
|
rcCaret.top = pt.y;
|
||||||
rcCaret.right = pt.x + CaretInfo->Size.cx;
|
rcCaret.right = pt.x + CaretInfo->Size.cx;
|
||||||
rcCaret.bottom = pt.y + CaretInfo->Size.cy;
|
rcCaret.bottom = pt.y + CaretInfo->Size.cy;
|
||||||
if (NtGdiIntersectRect(lprc, lprc, &rcCaret))
|
if (IntGdiIntersectRect(lprc, lprc, &rcCaret))
|
||||||
{
|
{
|
||||||
NtUserHideCaret(0);
|
NtUserHideCaret(0);
|
||||||
lprc->left = pt.x;
|
lprc->left = pt.x;
|
||||||
|
@ -717,9 +717,12 @@ IntFixCaret(HWND hWnd, LPRECT lprc, UINT flags)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HDC STDCALL
|
HDC STDCALL
|
||||||
NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
|
NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
|
PAINTSTRUCT Ps;
|
||||||
|
PROSRGNDATA Rgn;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (!(Window = IntGetWindowObject(hWnd)))
|
if (!(Window = IntGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
|
@ -729,10 +732,11 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
|
||||||
|
|
||||||
NtUserHideCaret(hWnd);
|
NtUserHideCaret(hWnd);
|
||||||
|
|
||||||
lPs->hdc = NtUserGetDCEx(hWnd, 0, DCX_INTERSECTUPDATE | DCX_WINDOWPAINT |
|
RtlZeroMemory(&Ps, sizeof(PAINTSTRUCT));
|
||||||
|
Ps.hdc = NtUserGetDCEx(hWnd, 0, DCX_INTERSECTUPDATE | DCX_WINDOWPAINT |
|
||||||
DCX_USESTYLE);
|
DCX_USESTYLE);
|
||||||
|
|
||||||
if (!lPs->hdc)
|
if (!Ps.hdc)
|
||||||
{
|
{
|
||||||
IntReleaseWindowObject(Window);
|
IntReleaseWindowObject(Window);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -743,33 +747,49 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
|
||||||
{
|
{
|
||||||
MsqDecPaintCountQueue(Window->MessageQueue);
|
MsqDecPaintCountQueue(Window->MessageQueue);
|
||||||
IntValidateParent(Window, Window->UpdateRegion);
|
IntValidateParent(Window, Window->UpdateRegion);
|
||||||
NtGdiGetRgnBox(Window->UpdateRegion, &lPs->rcPaint);
|
Rgn = RGNDATA_LockRgn(Window->UpdateRegion);
|
||||||
NtGdiOffsetRect(&lPs->rcPaint,
|
if (NULL != Rgn)
|
||||||
|
{
|
||||||
|
UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
|
||||||
|
RGNDATA_UnlockRgn(Window->UpdateRegion);
|
||||||
|
IntGdiOffsetRect(&Ps.rcPaint,
|
||||||
Window->WindowRect.left - Window->ClientRect.left,
|
Window->WindowRect.left - Window->ClientRect.left,
|
||||||
Window->WindowRect.top - Window->ClientRect.top);
|
Window->WindowRect.top - Window->ClientRect.top);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IntGetClientRect(Window, &Ps.rcPaint);
|
||||||
|
}
|
||||||
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
|
||||||
NtGdiDeleteObject(Window->UpdateRegion);
|
NtGdiDeleteObject(Window->UpdateRegion);
|
||||||
Window->UpdateRegion = NULL;
|
Window->UpdateRegion = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NtUserGetClientRect(Window->Self, &lPs->rcPaint);
|
IntGetClientRect(Window, &Ps.rcPaint);
|
||||||
}
|
}
|
||||||
IntUnLockWindowUpdate(Window);
|
IntUnLockWindowUpdate(Window);
|
||||||
|
|
||||||
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
|
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
|
||||||
{
|
{
|
||||||
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
Window->Flags &= ~WINDOWOBJECT_NEED_ERASEBKGND;
|
||||||
lPs->fErase = !IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)lPs->hdc, 0);
|
Ps.fErase = !IntSendMessage(hWnd, WM_ERASEBKGND, (WPARAM)Ps.hdc, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lPs->fErase = FALSE;
|
Ps.fErase = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntReleaseWindowObject(Window);
|
IntReleaseWindowObject(Window);
|
||||||
|
|
||||||
return lPs->hdc;
|
Status = MmCopyToCaller(UnsafePs, &Ps, sizeof(PAINTSTRUCT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ps.hdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1019,13 +1039,13 @@ NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
IntGdiGetClipBox(hDC, &rClip);
|
IntGdiGetClipBox(hDC, &rClip);
|
||||||
IntLPtoDP(DC, (LPPOINT)&rClip, 2);
|
IntLPtoDP(DC, (LPPOINT)&rClip, 2);
|
||||||
|
|
||||||
NtGdiIntersectRect(&rClipped_src, &rSrc, &rClip);
|
IntGdiIntersectRect(&rClipped_src, &rSrc, &rClip);
|
||||||
|
|
||||||
rDst = rClipped_src;
|
rDst = rClipped_src;
|
||||||
NtGdiSetRect(&offset, 0, 0, dx, dy);
|
IntGdiSetRect(&offset, 0, 0, dx, dy);
|
||||||
IntLPtoDP(DC, (LPPOINT)&offset, 2);
|
IntLPtoDP(DC, (LPPOINT)&offset, 2);
|
||||||
NtGdiOffsetRect(&rDst, offset.right - offset.left, offset.bottom - offset.top);
|
IntGdiOffsetRect(&rDst, offset.right - offset.left, offset.bottom - offset.top);
|
||||||
NtGdiIntersectRect(&rDst, &rDst, &rClip);
|
IntGdiIntersectRect(&rDst, &rDst, &rClip);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy bits, if possible.
|
* Copy bits, if possible.
|
||||||
|
@ -1035,7 +1055,7 @@ NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
{
|
{
|
||||||
RECT rDst_lp = rDst, rSrc_lp = rDst;
|
RECT rDst_lp = rDst, rSrc_lp = rDst;
|
||||||
|
|
||||||
NtGdiOffsetRect(&rSrc_lp, offset.left - offset.right, offset.top - offset.bottom);
|
IntGdiOffsetRect(&rSrc_lp, offset.left - offset.right, offset.top - offset.bottom);
|
||||||
IntDPtoLP(DC, (LPPOINT)&rDst_lp, 2);
|
IntDPtoLP(DC, (LPPOINT)&rDst_lp, 2);
|
||||||
IntDPtoLP(DC, (LPPOINT)&rSrc_lp, 2);
|
IntDPtoLP(DC, (LPPOINT)&rSrc_lp, 2);
|
||||||
DC_UnlockDc(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
@ -1097,10 +1117,10 @@ NtUserScrollDC(HDC hDC, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
|
||||||
const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
|
const RECT *UnsafeClipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
|
||||||
{
|
{
|
||||||
RECT rc, cliprc, caretrc;
|
RECT rc, cliprc, caretrc, rect, clipRect;
|
||||||
INT Result;
|
INT Result;
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
@ -1108,6 +1128,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
||||||
HWND hwndCaret;
|
HWND hwndCaret;
|
||||||
BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
|
BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
|
||||||
BOOL bOwnRgn = TRUE;
|
BOOL bOwnRgn = TRUE;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
Window = IntGetWindowObject(hWnd);
|
Window = IntGetWindowObject(hWnd);
|
||||||
if (!Window || !IntIsWindowDrawable(Window))
|
if (!Window || !IntIsWindowDrawable(Window))
|
||||||
|
@ -1117,11 +1138,27 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
IntGetClientRect(Window, &rc);
|
IntGetClientRect(Window, &rc);
|
||||||
if (rect)
|
if (NULL != UnsafeRect)
|
||||||
NtGdiIntersectRect(&rc, &rc, rect);
|
{
|
||||||
|
Status = MmCopyFromCaller(&rect, UnsafeRect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
IntGdiIntersectRect(&rc, &rc, &rect);
|
||||||
|
}
|
||||||
|
|
||||||
if (clipRect)
|
if (NULL != UnsafeClipRect)
|
||||||
NtGdiIntersectRect(&cliprc, &rc, clipRect);
|
{
|
||||||
|
Status = MmCopyFromCaller(&clipRect, UnsafeClipRect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
IntGdiIntersectRect(&cliprc, &rc, &clipRect);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cliprc = rc;
|
cliprc = rc;
|
||||||
|
|
||||||
|
@ -1180,7 +1217,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
|
||||||
r.top -= ClientOrigin.y;
|
r.top -= ClientOrigin.y;
|
||||||
r.right -= ClientOrigin.x;
|
r.right -= ClientOrigin.x;
|
||||||
r.bottom -= ClientOrigin.y;
|
r.bottom -= ClientOrigin.y;
|
||||||
if (!rect || NtGdiIntersectRect(&dummy, &r, &rc))
|
if (! UnsafeRect || IntGdiIntersectRect(&dummy, &r, &rc))
|
||||||
WinPosSetWindowPos(List[i], 0, r.left + dx, r.top + dy, 0, 0,
|
WinPosSetWindowPos(List[i], 0, r.left + dx, r.top + dy, 0, 0,
|
||||||
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
|
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
|
||||||
SWP_NOREDRAW);
|
SWP_NOREDRAW);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: window.c,v 1.247 2004/09/28 15:02:30 weiden Exp $
|
/* $Id: window.c,v 1.248 2004/11/15 23:10:42 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1338,7 +1338,7 @@ IntCalcDefPosSize(PWINDOW_OBJECT Parent, PWINDOW_OBJECT WindowObject, RECT *rc,
|
||||||
|
|
||||||
if(Parent != NULL)
|
if(Parent != NULL)
|
||||||
{
|
{
|
||||||
NtGdiIntersectRect(rc, rc, &Parent->ClientRect);
|
IntGdiIntersectRect(rc, rc, &Parent->ClientRect);
|
||||||
|
|
||||||
if(IncPos)
|
if(IncPos)
|
||||||
{
|
{
|
||||||
|
@ -1793,7 +1793,7 @@ IntCreateWindowEx(DWORD dwExStyle,
|
||||||
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
|
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
|
||||||
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
|
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
|
||||||
{
|
{
|
||||||
NtGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
|
IntGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
|
||||||
ParentWindow->ClientRect.top);
|
ParentWindow->ClientRect.top);
|
||||||
}
|
}
|
||||||
WindowObject->ClientRect = WindowObject->WindowRect;
|
WindowObject->ClientRect = WindowObject->WindowRect;
|
||||||
|
@ -1822,7 +1822,7 @@ IntCreateWindowEx(DWORD dwExStyle,
|
||||||
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
|
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
|
||||||
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
|
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
|
||||||
{
|
{
|
||||||
NtGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
|
IntGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
|
||||||
ParentWindow->ClientRect.top);
|
ParentWindow->ClientRect.top);
|
||||||
}
|
}
|
||||||
WindowObject->ClientRect = WindowObject->WindowRect;
|
WindowObject->ClientRect = WindowObject->WindowRect;
|
||||||
|
@ -1858,7 +1858,7 @@ IntCreateWindowEx(DWORD dwExStyle,
|
||||||
Result = WinPosGetNonClientSize(WindowObject->Self,
|
Result = WinPosGetNonClientSize(WindowObject->Self,
|
||||||
&WindowObject->WindowRect,
|
&WindowObject->WindowRect,
|
||||||
&WindowObject->ClientRect);
|
&WindowObject->ClientRect);
|
||||||
NtGdiOffsetRect(&WindowObject->WindowRect,
|
IntGdiOffsetRect(&WindowObject->WindowRect,
|
||||||
MaxPos.x - WindowObject->WindowRect.left,
|
MaxPos.x - WindowObject->WindowRect.left,
|
||||||
MaxPos.y - WindowObject->WindowRect.top);
|
MaxPos.y - WindowObject->WindowRect.top);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: winpos.c,v 1.121 2004/09/24 15:07:38 navaraf Exp $
|
/* $Id: winpos.c,v 1.122 2004/11/15 23:10:42 gvg Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -439,11 +439,11 @@ WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
|
||||||
Parent = IntGetParentObject(Window);
|
Parent = IntGetParentObject(Window);
|
||||||
if (0 != (Window->Style & WS_CHILD) && Parent)
|
if (0 != (Window->Style & WS_CHILD) && Parent)
|
||||||
{
|
{
|
||||||
NtGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left,
|
IntGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left,
|
||||||
- Parent->ClientRect.top);
|
- Parent->ClientRect.top);
|
||||||
NtGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left,
|
IntGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left,
|
||||||
- Parent->ClientRect.top);
|
- Parent->ClientRect.top);
|
||||||
NtGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left,
|
IntGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left,
|
||||||
- Parent->ClientRect.top);
|
- Parent->ClientRect.top);
|
||||||
}
|
}
|
||||||
params.lppos = &winposCopy;
|
params.lppos = &winposCopy;
|
||||||
|
@ -458,7 +458,7 @@ WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
|
||||||
*ClientRect = params.rgrc[0];
|
*ClientRect = params.rgrc[0];
|
||||||
if ((Window->Style & WS_CHILD) && Parent)
|
if ((Window->Style & WS_CHILD) && Parent)
|
||||||
{
|
{
|
||||||
NtGdiOffsetRect(ClientRect, Parent->ClientRect.left,
|
IntGdiOffsetRect(ClientRect, Parent->ClientRect.left,
|
||||||
Parent->ClientRect.top);
|
Parent->ClientRect.top);
|
||||||
}
|
}
|
||||||
FixClientRect(ClientRect, WindowRect);
|
FixClientRect(ClientRect, WindowRect);
|
||||||
|
@ -534,7 +534,7 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject,
|
||||||
WindowRect->top = Y;
|
WindowRect->top = Y;
|
||||||
WindowRect->right += X - WindowObject->WindowRect.left;
|
WindowRect->right += X - WindowObject->WindowRect.left;
|
||||||
WindowRect->bottom += Y - WindowObject->WindowRect.top;
|
WindowRect->bottom += Y - WindowObject->WindowRect.top;
|
||||||
NtGdiOffsetRect(ClientRect,
|
IntGdiOffsetRect(ClientRect,
|
||||||
X - WindowObject->WindowRect.left,
|
X - WindowObject->WindowRect.left,
|
||||||
Y - WindowObject->WindowRect.top);
|
Y - WindowObject->WindowRect.top);
|
||||||
}
|
}
|
||||||
|
@ -1025,9 +1025,9 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
|
||||||
{
|
{
|
||||||
RECT ORect = OldClientRect;
|
RECT ORect = OldClientRect;
|
||||||
RECT NRect = NewClientRect;
|
RECT NRect = NewClientRect;
|
||||||
NtGdiOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect.top);
|
IntGdiOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect.top);
|
||||||
NtGdiOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect.top);
|
IntGdiOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect.top);
|
||||||
NtGdiIntersectRect(&CopyRect, &ORect, &NRect);
|
IntGdiIntersectRect(&CopyRect, &ORect, &NRect);
|
||||||
REGION_CropRgn(CopyRgn, CopyRgn, &CopyRect, NULL);
|
REGION_CropRgn(CopyRgn, CopyRgn, &CopyRect, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,44 +16,100 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: rect.c,v 1.7 2004/05/10 17:07:20 weiden Exp $ */
|
/* $Id: rect.c,v 1.8 2004/11/15 23:10:42 gvg Exp $ */
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
BOOL STDCALL
|
VOID FASTCALL
|
||||||
NtGdiSetEmptyRect(PRECT Rect)
|
IntGdiSetEmptyRect(PRECT Rect)
|
||||||
{
|
{
|
||||||
Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
|
Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiIsEmptyRect(const RECT* Rect)
|
NtGdiSetEmptyRect(PRECT UnsafeRect)
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
IntGdiSetEmptyRect(&Rect);
|
||||||
|
|
||||||
|
Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiIsEmptyRect(const RECT* Rect)
|
||||||
{
|
{
|
||||||
return(Rect->left >= Rect->right || Rect->top >= Rect->bottom);
|
return(Rect->left >= Rect->right || Rect->top >= Rect->bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiOffsetRect(LPRECT Rect, INT x, INT y)
|
NtGdiIsEmptyRect(const RECT* UnsafeRect)
|
||||||
|
{
|
||||||
|
RECT Rect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&Rect, UnsafeRect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IntGdiIsEmptyRect(&Rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntGdiOffsetRect(LPRECT Rect, INT x, INT y)
|
||||||
{
|
{
|
||||||
Rect->left += x;
|
Rect->left += x;
|
||||||
Rect->right += x;
|
Rect->right += x;
|
||||||
Rect->top += y;
|
Rect->top += y;
|
||||||
Rect->bottom += y;
|
Rect->bottom += y;
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
NtGdiOffsetRect(LPRECT UnsafeRect, INT x, INT y)
|
||||||
{
|
{
|
||||||
if (NtGdiIsEmptyRect(Src1))
|
RECT Rect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&Rect, UnsafeRect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (NtGdiIsEmptyRect(Src2))
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntGdiOffsetRect(&Rect, x, y);
|
||||||
|
|
||||||
|
Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
NtGdiSetEmptyRect(Dest);
|
SetLastNtError(Status);
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
||||||
|
{
|
||||||
|
if (IntGdiIsEmptyRect(Src1))
|
||||||
|
{
|
||||||
|
if (IntGdiIsEmptyRect(Src2))
|
||||||
|
{
|
||||||
|
IntGdiSetEmptyRect(Dest);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -62,7 +118,7 @@ NtGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (NtGdiIsEmptyRect(Src2))
|
if (IntGdiIsEmptyRect(Src2))
|
||||||
{
|
{
|
||||||
*Dest = *Src1;
|
*Dest = *Src1;
|
||||||
}
|
}
|
||||||
|
@ -74,33 +130,124 @@ NtGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
||||||
Dest->bottom = max(Src1->bottom, Src2->bottom);
|
Dest->bottom = max(Src1->bottom, Src2->bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(TRUE);
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiSetRect(PRECT Rect, INT left, INT top, INT right, INT bottom)
|
NtGdiUnionRect(PRECT UnsafeDest, const RECT* UnsafeSrc1, const RECT* UnsafeSrc2)
|
||||||
|
{
|
||||||
|
RECT Dest, Src1, Src2;
|
||||||
|
NTSTATUS Status;
|
||||||
|
BOOL Ret;
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&Src1, UnsafeSrc1, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Status = MmCopyFromCaller(&Src2, UnsafeSrc2, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = IntGdiUnionRect(&Dest, &Src1, &Src2);
|
||||||
|
|
||||||
|
if (Ret)
|
||||||
|
{
|
||||||
|
Status = MmCopyToCaller(UnsafeDest, &Dest, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
IntGdiSetRect(PRECT Rect, INT left, INT top, INT right, INT bottom)
|
||||||
{
|
{
|
||||||
Rect->left = left;
|
Rect->left = left;
|
||||||
Rect->top = top;
|
Rect->top = top;
|
||||||
Rect->right = right;
|
Rect->right = right;
|
||||||
Rect->bottom = bottom;
|
Rect->bottom = bottom;
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtGdiIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
NtGdiSetRect(PRECT UnsafeRect, INT left, INT top, INT right, INT bottom)
|
||||||
{
|
{
|
||||||
if (NtGdiIsEmptyRect(Src1) || NtGdiIsEmptyRect(Src2) ||
|
RECT Rect;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
IntGdiSetRect(&Rect, left, top, right, bottom);
|
||||||
|
|
||||||
|
Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGdiIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
|
||||||
|
{
|
||||||
|
if (IntGdiIsEmptyRect(Src1) || IntGdiIsEmptyRect(Src2) ||
|
||||||
Src1->left >= Src2->right || Src2->left >= Src1->right ||
|
Src1->left >= Src2->right || Src2->left >= Src1->right ||
|
||||||
Src1->top >= Src2->bottom || Src2->top >= Src1->bottom)
|
Src1->top >= Src2->bottom || Src2->top >= Src1->bottom)
|
||||||
{
|
{
|
||||||
NtGdiSetEmptyRect(Dest);
|
IntGdiSetEmptyRect(Dest);
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dest->left = max(Src1->left, Src2->left);
|
Dest->left = max(Src1->left, Src2->left);
|
||||||
Dest->right = min(Src1->right, Src2->right);
|
Dest->right = min(Src1->right, Src2->right);
|
||||||
Dest->top = max(Src1->top, Src2->top);
|
Dest->top = max(Src1->top, Src2->top);
|
||||||
Dest->bottom = min(Src1->bottom, Src2->bottom);
|
Dest->bottom = min(Src1->bottom, Src2->bottom);
|
||||||
return(TRUE);
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
NtGdiIntersectRect(PRECT UnsafeDest, const RECT* UnsafeSrc1, const RECT* UnsafeSrc2)
|
||||||
|
{
|
||||||
|
RECT Dest, Src1, Src2;
|
||||||
|
NTSTATUS Status;
|
||||||
|
BOOL Ret;
|
||||||
|
|
||||||
|
Status = MmCopyFromCaller(&Src1, UnsafeSrc1, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Status = MmCopyFromCaller(&Src2, UnsafeSrc2, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = IntGdiIntersectRect(&Dest, &Src2, &Src2);
|
||||||
|
|
||||||
|
if (Ret)
|
||||||
|
{
|
||||||
|
Status = MmCopyToCaller(UnsafeDest, &Dest, sizeof(RECT));
|
||||||
|
if (! NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue