2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <ddk/ntddk.h>
22 #include <win32k/region.h>
23 #include <win32k/gdiobj.h>
24 #include <include/rect.h>
27 #include <win32k/debug1.h>
29 /* FUNCTIONS *****************************************************************/
32 NtGdiSetEmptyRect(PRECT Rect)
34 Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
39 NtGdiIsEmptyRect(const RECT* Rect)
41 return(Rect->left >= Rect->right || Rect->top >= Rect->bottom);
45 NtGdiOffsetRect(LPRECT Rect, INT x, INT y)
56 NtGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
58 if (NtGdiIsEmptyRect(Src1))
60 if (NtGdiIsEmptyRect(Src2))
62 NtGdiSetEmptyRect(Dest);
72 if (NtGdiIsEmptyRect(Src2))
78 Dest->left = min(Src1->left, Src2->left);
79 Dest->top = min(Src1->top, Src2->top);
80 Dest->right = max(Src1->right, Src2->right);
81 Dest->bottom = max(Src1->bottom, Src2->bottom);
88 NtGdiSetRect(PRECT Rect, INT left, INT top, INT right, INT bottom)
93 Rect->bottom = bottom;
98 NtGdiIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
100 if (NtGdiIsEmptyRect(Src1) || NtGdiIsEmptyRect(Src2) ||
101 Src1->left >= Src2->right || Src2->left >= Src1->right ||
102 Src1->top >= Src2->bottom || Src2->top >= Src1->bottom)
104 NtGdiSetEmptyRect(Dest);
107 Dest->left = max(Src1->left, Src2->left);
108 Dest->right = min(Src1->right, Src2->right);
109 Dest->top = max(Src1->top, Src2->top);
110 Dest->bottom = min(Src1->bottom, Src2->bottom);