ReactOS 0.4.16-dev-297-gc569aee
rect.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ConioInitLongRect(Rect, Top, Left, Bottom, Right)
 
#define ConioInitRect(Rect, top, left, bottom, right)
 
#define ConioIsRectEmpty(Rect)    (((Rect)->Left > (Rect)->Right) || ((Rect)->Top > (Rect)->Bottom))
 
#define ConioRectHeight(Rect)    (((Rect)->Top > (Rect)->Bottom) ? 0 : ((Rect)->Bottom - (Rect)->Top + 1))
 
#define ConioRectWidth(Rect)    (((Rect)->Left > (Rect)->Right) ? 0 : ((Rect)->Right - (Rect)->Left + 1))
 

Functions

static __inline BOOLEAN ConioGetIntersection (OUT PSMALL_RECT Intersection, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
 
static __inline BOOLEAN ConioGetUnion (OUT PSMALL_RECT Union, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
 

Macro Definition Documentation

◆ ConioInitLongRect

#define ConioInitLongRect (   Rect,
  Top,
  Left,
  Bottom,
  Right 
)
Value:
do { \
((Rect)->top) = Top; \
((Rect)->left) = Left; \
((Rect)->bottom) = Bottom; \
((Rect)->right) = Right; \
} while (0)
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726

Definition at line 12 of file rect.h.

◆ ConioInitRect

#define ConioInitRect (   Rect,
  top,
  left,
  bottom,
  right 
)
Value:
do { \
((Rect)->Top) = top; \
((Rect)->Left) = left; \
((Rect)->Bottom) = bottom; \
((Rect)->Right) = right; \
} while (0)

Definition at line 20 of file rect.h.

◆ ConioIsRectEmpty

#define ConioIsRectEmpty (   Rect)     (((Rect)->Left > (Rect)->Right) || ((Rect)->Top > (Rect)->Bottom))

Definition at line 28 of file rect.h.

◆ ConioRectHeight

#define ConioRectHeight (   Rect)     (((Rect)->Top > (Rect)->Bottom) ? 0 : ((Rect)->Bottom - (Rect)->Top + 1))

Definition at line 31 of file rect.h.

◆ ConioRectWidth

#define ConioRectWidth (   Rect)     (((Rect)->Left > (Rect)->Right) ? 0 : ((Rect)->Right - (Rect)->Left + 1))

Definition at line 33 of file rect.h.

Function Documentation

◆ ConioGetIntersection()

static __inline BOOLEAN ConioGetIntersection ( OUT PSMALL_RECT  Intersection,
IN PSMALL_RECT  Rect1,
IN PSMALL_RECT  Rect2 
)
static

Definition at line 38 of file rect.h.

41{
42 if ( ConioIsRectEmpty(Rect1) ||
43 ConioIsRectEmpty(Rect2) ||
44 (Rect1->Top > Rect2->Bottom) ||
45 (Rect1->Left > Rect2->Right) ||
46 (Rect1->Bottom < Rect2->Top) ||
47 (Rect1->Right < Rect2->Left) )
48 {
49 /* The rectangles do not intersect */
50 ConioInitRect(Intersection, 0, -1, 0, -1);
51 return FALSE;
52 }
53
54 ConioInitRect(Intersection,
55 max(Rect1->Top , Rect2->Top ),
56 max(Rect1->Left , Rect2->Left ),
57 min(Rect1->Bottom, Rect2->Bottom),
58 min(Rect1->Right , Rect2->Right ));
59
60 return TRUE;
61}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:20
#define ConioIsRectEmpty(Rect)
Definition: rect.h:28

Referenced by ConDrvReadConsoleOutput(), ConDrvScrollConsoleScreenBuffer(), ConDrvWriteConsoleOutput(), and ConDrvWriteConsoleOutputVDM().

◆ ConioGetUnion()

static __inline BOOLEAN ConioGetUnion ( OUT PSMALL_RECT  Union,
IN PSMALL_RECT  Rect1,
IN PSMALL_RECT  Rect2 
)
static

Definition at line 64 of file rect.h.

67{
68 if (ConioIsRectEmpty(Rect1))
69 {
70 if (ConioIsRectEmpty(Rect2))
71 {
72 ConioInitRect(Union, 0, -1, 0, -1);
73 return FALSE;
74 }
75 else
76 {
77 *Union = *Rect2;
78 }
79 }
80 else if (ConioIsRectEmpty(Rect2))
81 {
82 *Union = *Rect1;
83 }
84 else
85 {
86 ConioInitRect(Union,
87 min(Rect1->Top , Rect2->Top ),
88 min(Rect1->Left , Rect2->Left ),
89 max(Rect1->Bottom, Rect2->Bottom),
90 max(Rect1->Right , Rect2->Right ));
91 }
92
93 return TRUE;
94}

Referenced by ConDrvScrollConsoleScreenBuffer().