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.
26 /* FUNCTIONS *****************************************************************/
29 IntGdiSetEmptyRect(PRECT Rect
)
31 Rect
->left
= Rect
->right
= Rect
->top
= Rect
->bottom
= 0;
35 IntGdiIsEmptyRect(const RECT
* Rect
)
37 return(Rect
->left
>= Rect
->right
|| Rect
->top
>= Rect
->bottom
);
41 IntGdiOffsetRect(LPRECT Rect
, INT x
, INT y
)
50 IntGdiUnionRect(PRECT Dest
, const RECT
* Src1
, const RECT
* Src2
)
52 if (IntGdiIsEmptyRect(Src1
))
54 if (IntGdiIsEmptyRect(Src2
))
56 IntGdiSetEmptyRect(Dest
);
66 if (IntGdiIsEmptyRect(Src2
))
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
);
83 IntGdiSetRect(PRECT Rect
, INT left
, INT top
, INT right
, INT bottom
)
88 Rect
->bottom
= bottom
;
92 IntGdiIntersectRect(PRECT Dest
, const RECT
* Src1
, const RECT
* Src2
)
94 if (IntGdiIsEmptyRect(Src1
) || IntGdiIsEmptyRect(Src2
) ||
95 Src1
->left
>= Src2
->right
|| Src2
->left
>= Src1
->right
||
96 Src1
->top
>= Src2
->bottom
|| Src2
->top
>= Src1
->bottom
)
98 IntGdiSetEmptyRect(Dest
);
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
);