6 modified files
reactos/subsys/win32k/eng
diff -u -r1.10 -r1.11
--- gradient.c 3 Jul 2004 13:55:35 -0000 1.10
+++ gradient.c 15 Nov 2004 23:10:41 -0000 1.11
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@@ -119,7 +119,7 @@
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
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(Green, 1);
@@ -147,7 +147,7 @@
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
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(Green, 1);
@@ -183,7 +183,7 @@
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
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++)
{
@@ -363,7 +363,7 @@
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
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;
@@ -411,7 +411,7 @@
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
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, v2, 1);
reactos/subsys/win32k/include
diff -u -r1.15 -r1.16
--- intgdi.h 14 Jul 2004 20:48:57 -0000 1.15
+++ intgdi.h 15 Nov 2004 23:10:42 -0000 1.16
@@ -145,5 +145,25 @@
LPXFORM xform1,
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 */
reactos/subsys/win32k/ntuser
diff -u -r1.86 -r1.87
--- painting.c 28 Sep 2004 15:02:30 -0000 1.86
+++ painting.c 15 Nov 2004 23:10:42 -0000 1.87
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@@ -695,7 +695,7 @@
rcCaret.top = pt.y;
rcCaret.right = pt.x + CaretInfo->Size.cx;
rcCaret.bottom = pt.y + CaretInfo->Size.cy;
- if (NtGdiIntersectRect(lprc, lprc, &rcCaret))
+ if (IntGdiIntersectRect(lprc, lprc, &rcCaret))
{
NtUserHideCaret(0);
lprc->left = pt.x;
@@ -717,9 +717,12 @@
*/
HDC STDCALL
-NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
+NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
{
PWINDOW_OBJECT Window;
+ PAINTSTRUCT Ps;
+ PROSRGNDATA Rgn;
+ NTSTATUS Status;
if (!(Window = IntGetWindowObject(hWnd)))
{
@@ -729,10 +732,11 @@
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);
- if (!lPs->hdc)
+ if (!Ps.hdc)
{
IntReleaseWindowObject(Window);
return NULL;
@@ -743,33 +747,49 @@
{
MsqDecPaintCountQueue(Window->MessageQueue);
IntValidateParent(Window, Window->UpdateRegion);
- NtGdiGetRgnBox(Window->UpdateRegion, &lPs->rcPaint);
- NtGdiOffsetRect(&lPs->rcPaint,
- Window->WindowRect.left - Window->ClientRect.left,
- Window->WindowRect.top - Window->ClientRect.top);
+ Rgn = RGNDATA_LockRgn(Window->UpdateRegion);
+ if (NULL != Rgn)
+ {
+ UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
+ RGNDATA_UnlockRgn(Window->UpdateRegion);
+ IntGdiOffsetRect(&Ps.rcPaint,
+ Window->WindowRect.left - Window->ClientRect.left,
+ Window->WindowRect.top - Window->ClientRect.top);
+ }
+ else
+ {
+ IntGetClientRect(Window, &Ps.rcPaint);
+ }
GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
NtGdiDeleteObject(Window->UpdateRegion);
Window->UpdateRegion = NULL;
}
else
{
- NtUserGetClientRect(Window->Self, &lPs->rcPaint);
+ IntGetClientRect(Window, &Ps.rcPaint);
}
IntUnLockWindowUpdate(Window);
if (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
{
- lPs->fErase = FALSE;
+ Ps.fErase = FALSE;
}
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 @@
IntGdiGetClipBox(hDC, &rClip);
IntLPtoDP(DC, (LPPOINT)&rClip, 2);
- NtGdiIntersectRect(&rClipped_src, &rSrc, &rClip);
+ IntGdiIntersectRect(&rClipped_src, &rSrc, &rClip);
rDst = rClipped_src;
- NtGdiSetRect(&offset, 0, 0, dx, dy);
+ IntGdiSetRect(&offset, 0, 0, dx, dy);
IntLPtoDP(DC, (LPPOINT)&offset, 2);
- NtGdiOffsetRect(&rDst, offset.right - offset.left, offset.bottom - offset.top);
- NtGdiIntersectRect(&rDst, &rDst, &rClip);
+ IntGdiOffsetRect(&rDst, offset.right - offset.left, offset.bottom - offset.top);
+ IntGdiIntersectRect(&rDst, &rDst, &rClip);
/*
* Copy bits, if possible.
@@ -1035,7 +1055,7 @@
{
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)&rSrc_lp, 2);
DC_UnlockDc(hDC);
@@ -1097,10 +1117,10 @@
*/
DWORD STDCALL
-NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect,
- const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
+NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *UnsafeRect,
+ const RECT *UnsafeClipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
{
- RECT rc, cliprc, caretrc;
+ RECT rc, cliprc, caretrc, rect, clipRect;
INT Result;
PWINDOW_OBJECT Window;
HDC hDC;
@@ -1108,6 +1128,7 @@
HWND hwndCaret;
BOOL bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
BOOL bOwnRgn = TRUE;
+ NTSTATUS Status;
Window = IntGetWindowObject(hWnd);
if (!Window || !IntIsWindowDrawable(Window))
@@ -1117,11 +1138,27 @@
}
IntGetClientRect(Window, &rc);
- if (rect)
- NtGdiIntersectRect(&rc, &rc, rect);
+ if (NULL != UnsafeRect)
+ {
+ Status = MmCopyFromCaller(&rect, UnsafeRect, sizeof(RECT));
+ if (! NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ return ERROR;
+ }
+ IntGdiIntersectRect(&rc, &rc, &rect);
+ }
- if (clipRect)
- NtGdiIntersectRect(&cliprc, &rc, clipRect);
+ if (NULL != UnsafeClipRect)
+ {
+ Status = MmCopyFromCaller(&clipRect, UnsafeClipRect, sizeof(RECT));
+ if (! NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ return ERROR;
+ }
+ IntGdiIntersectRect(&cliprc, &rc, &clipRect);
+ }
else
cliprc = rc;
@@ -1180,7 +1217,7 @@
r.top -= ClientOrigin.y;
r.right -= ClientOrigin.x;
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,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE |
SWP_NOREDRAW);
reactos/subsys/win32k/ntuser
diff -u -r1.247 -r1.248
--- window.c 28 Sep 2004 15:02:30 -0000 1.247
+++ window.c 15 Nov 2004 23:10:42 -0000 1.248
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@@ -1338,7 +1338,7 @@
if(Parent != NULL)
{
- NtGdiIntersectRect(rc, rc, &Parent->ClientRect);
+ IntGdiIntersectRect(rc, rc, &Parent->ClientRect);
if(IncPos)
{
@@ -1793,7 +1793,7 @@
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
{
- NtGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
+ IntGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
ParentWindow->ClientRect.top);
}
WindowObject->ClientRect = WindowObject->WindowRect;
@@ -1822,7 +1822,7 @@
WindowObject->WindowRect.bottom = Pos.y + Size.cy;
if (0 != (WindowObject->Style & WS_CHILD) && ParentWindow)
{
- NtGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
+ IntGdiOffsetRect(&(WindowObject->WindowRect), ParentWindow->ClientRect.left,
ParentWindow->ClientRect.top);
}
WindowObject->ClientRect = WindowObject->WindowRect;
@@ -1858,7 +1858,7 @@
Result = WinPosGetNonClientSize(WindowObject->Self,
&WindowObject->WindowRect,
&WindowObject->ClientRect);
- NtGdiOffsetRect(&WindowObject->WindowRect,
+ IntGdiOffsetRect(&WindowObject->WindowRect,
MaxPos.x - WindowObject->WindowRect.left,
MaxPos.y - WindowObject->WindowRect.top);
reactos/subsys/win32k/ntuser
diff -u -r1.121 -r1.122
--- winpos.c 24 Sep 2004 15:07:38 -0000 1.121
+++ winpos.c 15 Nov 2004 23:10:42 -0000 1.122
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@@ -439,11 +439,11 @@
Parent = IntGetParentObject(Window);
if (0 != (Window->Style & WS_CHILD) && Parent)
{
- NtGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left,
+ IntGdiOffsetRect(&(params.rgrc[0]), - Parent->ClientRect.left,
- Parent->ClientRect.top);
- NtGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left,
+ IntGdiOffsetRect(&(params.rgrc[1]), - Parent->ClientRect.left,
- Parent->ClientRect.top);
- NtGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left,
+ IntGdiOffsetRect(&(params.rgrc[2]), - Parent->ClientRect.left,
- Parent->ClientRect.top);
}
params.lppos = &winposCopy;
@@ -458,7 +458,7 @@
*ClientRect = params.rgrc[0];
if ((Window->Style & WS_CHILD) && Parent)
{
- NtGdiOffsetRect(ClientRect, Parent->ClientRect.left,
+ IntGdiOffsetRect(ClientRect, Parent->ClientRect.left,
Parent->ClientRect.top);
}
FixClientRect(ClientRect, WindowRect);
@@ -534,7 +534,7 @@
WindowRect->top = Y;
WindowRect->right += X - WindowObject->WindowRect.left;
WindowRect->bottom += Y - WindowObject->WindowRect.top;
- NtGdiOffsetRect(ClientRect,
+ IntGdiOffsetRect(ClientRect,
X - WindowObject->WindowRect.left,
Y - WindowObject->WindowRect.top);
}
@@ -1025,9 +1025,9 @@
{
RECT ORect = OldClientRect;
RECT NRect = NewClientRect;
- NtGdiOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect.top);
- NtGdiOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect.top);
- NtGdiIntersectRect(&CopyRect, &ORect, &NRect);
+ IntGdiOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect.top);
+ IntGdiOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect.top);
+ IntGdiIntersectRect(&CopyRect, &ORect, &NRect);
REGION_CropRgn(CopyRgn, CopyRgn, &CopyRect, NULL);
}
reactos/subsys/win32k/objects
diff -u -r1.7 -r1.8
--- rect.c 10 May 2004 17:07:20 -0000 1.7
+++ rect.c 15 Nov 2004 23:10:42 -0000 1.8
@@ -16,44 +16,100 @@
* along with this program; if not, write to the Free Software
* 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>
/* FUNCTIONS *****************************************************************/
-BOOL STDCALL
-NtGdiSetEmptyRect(PRECT Rect)
+VOID FASTCALL
+IntGdiSetEmptyRect(PRECT Rect)
{
Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
- return(TRUE);
}
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);
}
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->right += x;
Rect->top += y;
Rect->bottom += y;
- return(TRUE);
}
-
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))
+ {
+ SetLastNtError(Status);
+ return FALSE;
+ }
+
+ IntGdiOffsetRect(&Rect, x, y);
+
+ Status = MmCopyToCaller(UnsafeRect, &Rect, sizeof(RECT));
+ if (! NT_SUCCESS(Status))
{
- if (NtGdiIsEmptyRect(Src2))
+ SetLastNtError(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL FASTCALL
+IntGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
+{
+ if (IntGdiIsEmptyRect(Src1))
+ {
+ if (IntGdiIsEmptyRect(Src2))
{
- NtGdiSetEmptyRect(Dest);
- return(FALSE);
+ IntGdiSetEmptyRect(Dest);
+ return FALSE;
}
else
{
@@ -62,7 +118,7 @@
}
else
{
- if (NtGdiIsEmptyRect(Src2))
+ if (IntGdiIsEmptyRect(Src2))
{
*Dest = *Src1;
}
@@ -74,33 +130,124 @@
Dest->bottom = max(Src1->bottom, Src2->bottom);
}
}
- return(TRUE);
+
+ return TRUE;
}
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->top = top;
Rect->right = right;
Rect->bottom = bottom;
- return(TRUE);
}
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->top >= Src2->bottom || Src2->top >= Src1->bottom)
{
- NtGdiSetEmptyRect(Dest);
- return(FALSE);
+ IntGdiSetEmptyRect(Dest);
+ return FALSE;
}
+
Dest->left = max(Src1->left, Src2->left);
Dest->right = min(Src1->right, Src2->right);
Dest->top = max(Src1->top, Src2->top);
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 */
CVSspam 0.2.8