Fix spurious warning/error reported by GCC 4.4.0.
[reactos.git] / reactos / subsystems / win32 / win32k / objects / rect.c
1 /*
2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
4 *
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.
9 *
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.
14 *
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.
18 */
19 /* $Id$ */
20
21 #include <w32k.h>
22
23 #define NDEBUG
24 #include <debug.h>
25
26 /* FUNCTIONS *****************************************************************/
27
28 VOID FASTCALL
29 IntGdiSetEmptyRect(PRECT Rect)
30 {
31 Rect->left = Rect->right = Rect->top = Rect->bottom = 0;
32 }
33
34 BOOL FASTCALL
35 IntGdiIsEmptyRect(const RECT* Rect)
36 {
37 return(Rect->left >= Rect->right || Rect->top >= Rect->bottom);
38 }
39
40 VOID FASTCALL
41 IntGdiOffsetRect(LPRECT Rect, INT x, INT y)
42 {
43 Rect->left += x;
44 Rect->right += x;
45 Rect->top += y;
46 Rect->bottom += y;
47 }
48
49 BOOL FASTCALL
50 IntGdiUnionRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
51 {
52 if (IntGdiIsEmptyRect(Src1))
53 {
54 if (IntGdiIsEmptyRect(Src2))
55 {
56 IntGdiSetEmptyRect(Dest);
57 return FALSE;
58 }
59 else
60 {
61 *Dest = *Src2;
62 }
63 }
64 else
65 {
66 if (IntGdiIsEmptyRect(Src2))
67 {
68 *Dest = *Src1;
69 }
70 else
71 {
72 Dest->left = min(Src1->left, Src2->left);
73 Dest->top = min(Src1->top, Src2->top);
74 Dest->right = max(Src1->right, Src2->right);
75 Dest->bottom = max(Src1->bottom, Src2->bottom);
76 }
77 }
78
79 return TRUE;
80 }
81
82 VOID FASTCALL
83 IntGdiSetRect(PRECT Rect, INT left, INT top, INT right, INT bottom)
84 {
85 Rect->left = left;
86 Rect->top = top;
87 Rect->right = right;
88 Rect->bottom = bottom;
89 }
90
91 BOOL FASTCALL
92 IntGdiIntersectRect(PRECT Dest, const RECT* Src1, const RECT* Src2)
93 {
94 if (IntGdiIsEmptyRect(Src1) || IntGdiIsEmptyRect(Src2) ||
95 Src1->left >= Src2->right || Src2->left >= Src1->right ||
96 Src1->top >= Src2->bottom || Src2->top >= Src1->bottom)
97 {
98 IntGdiSetEmptyRect(Dest);
99 return FALSE;
100 }
101
102 Dest->left = max(Src1->left, Src2->left);
103 Dest->right = min(Src1->right, Src2->right);
104 Dest->top = max(Src1->top, Src2->top);
105 Dest->bottom = min(Src1->bottom, Src2->bottom);
106
107 return TRUE;
108 }
109
110
111 /* EOF */