ReactOS 0.4.16-dev-303-g11d5cb8
rect.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/gdi/ntgdi/rect.c
5 * PURPOSE: Rect functions
6 * PROGRAMMER: Timo Kreuzer
7 */
8
9#include <win32k.h>
10
11#define NDEBUG
12#include <debug.h>
13
14/* FUNCTIONS *****************************************************************/
15
16BOOL
20 _In_ const RECTL *prcl1,
21 _In_ const RECTL *prcl2)
22{
23 if (RECTL_bIsEmptyRect(prcl1))
24 {
25 if (RECTL_bIsEmptyRect(prcl2))
26 {
28 return FALSE;
29 }
30 else
31 {
32 *prclDst = *prcl2;
33 }
34 }
35 else
36 {
37 if (RECTL_bIsEmptyRect(prcl2))
38 {
39 *prclDst = *prcl1;
40 }
41 else
42 {
43 prclDst->left = min(prcl1->left, prcl2->left);
44 prclDst->top = min(prcl1->top, prcl2->top);
45 prclDst->right = max(prcl1->right, prcl2->right);
46 prclDst->bottom = max(prcl1->bottom, prcl2->bottom);
47 }
48 }
49
50 return TRUE;
51}
52
53BOOL
57 _In_ const RECTL* prcl1,
58 _In_ const RECTL* prcl2)
59{
60 prclDst->left = max(prcl1->left, prcl2->left);
61 prclDst->right = min(prcl1->right, prcl2->right);
62
63 if (prclDst->left < prclDst->right)
64 {
65 prclDst->top = max(prcl1->top, prcl2->top);
66 prclDst->bottom = min(prcl1->bottom, prcl2->bottom);
67
68 if (prclDst->top < prclDst->bottom)
69 {
70 return TRUE;
71 }
72 }
73
75
76 return FALSE;
77}
78
79VOID
83{
84 LONG lTmp;
85 if (prcl->left > prcl->right)
86 {
87 lTmp = prcl->left;
88 prcl->left = prcl->right;
89 prcl->right = lTmp;
90 }
91 if (prcl->top > prcl->bottom)
92 {
93 lTmp = prcl->top;
94 prcl->top = prcl->bottom;
95 prcl->bottom = lTmp;
96 }
97}
98
99VOID
103 _In_ INT dx,
104 _In_ INT dy)
105{
106 rect->left -= dx;
107 rect->top -= dy;
108 rect->right += dx;
109 rect->bottom += dy;
110}
111
112/* EOF */
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define min(a, b)
Definition: monoChain.cc:55
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define FASTCALL
Definition: nt_native.h:50
long LONG
Definition: pedump.c:60
& rect
Definition: startmenu.cpp:1413
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL * prclDst
Definition: winddi.h:4193
_In_ ULONG _In_ CLIPOBJ _In_ RECTL * prcl
Definition: winddi.h:3531