1 #pragma once
2
3 FORCEINLINE
4 VOID
RECTL_vSetRect(_Out_ RECTL * prcl,_In_ LONG left,_In_ LONG top,_In_ LONG right,_In_ LONG bottom)5 RECTL_vSetRect(
6 _Out_ RECTL *prcl,
7 _In_ LONG left,
8 _In_ LONG top,
9 _In_ LONG right,
10 _In_ LONG bottom)
11 {
12 prcl->left = left;
13 prcl->top = top;
14 prcl->right = right;
15 prcl->bottom = bottom;
16 }
17
18 FORCEINLINE
19 VOID
RECTL_vSetEmptyRect(_Out_ RECTL * prcl)20 RECTL_vSetEmptyRect(
21 _Out_ RECTL *prcl)
22 {
23 prcl->left = 0;
24 prcl->top = 0;
25 prcl->right = 0;
26 prcl->bottom = 0;
27 }
28
29 FORCEINLINE
30 VOID
RECTL_vOffsetRect(_Inout_ RECTL * prcl,_In_ INT cx,_In_ INT cy)31 RECTL_vOffsetRect(
32 _Inout_ RECTL *prcl,
33 _In_ INT cx,
34 _In_ INT cy)
35 {
36 prcl->left += cx;
37 prcl->right += cx;
38 prcl->top += cy;
39 prcl->bottom += cy;
40 }
41
42 FORCEINLINE
43 BOOL
RECTL_bIsEmptyRect(_In_ const RECTL * prcl)44 RECTL_bIsEmptyRect(
45 _In_ const RECTL *prcl)
46 {
47 return (prcl->left >= prcl->right || prcl->top >= prcl->bottom);
48 }
49
50 FORCEINLINE
51 BOOL
RECTL_bPointInRect(_In_ const RECTL * prcl,_In_ INT x,_In_ INT y)52 RECTL_bPointInRect(
53 _In_ const RECTL *prcl,
54 _In_ INT x,
55 _In_ INT y)
56 {
57 return (x >= prcl->left && x < prcl->right &&
58 y >= prcl->top && y < prcl->bottom);
59 }
60
61 FORCEINLINE
62 BOOL
RECTL_bIsWellOrdered(_In_ const RECTL * prcl)63 RECTL_bIsWellOrdered(
64 _In_ const RECTL *prcl)
65 {
66 return ((prcl->left <= prcl->right) &&
67 (prcl->top <= prcl->bottom));
68 }
69
70 FORCEINLINE
71 BOOL
RECTL_bClipRectBySize(_Out_ RECTL * prclDst,_In_ const RECTL * prclSrc,_In_ const SIZEL * pszl)72 RECTL_bClipRectBySize(
73 _Out_ RECTL *prclDst,
74 _In_ const RECTL *prclSrc,
75 _In_ const SIZEL *pszl)
76 {
77 prclDst->left = max(prclSrc->left, 0);
78 prclDst->top = max(prclSrc->top, 0);
79 prclDst->right = min(prclSrc->right, pszl->cx);
80 prclDst->bottom = min(prclSrc->bottom, pszl->cy);
81 return !RECTL_bIsEmptyRect(prclDst);
82 }
83
84 FORCEINLINE
85 LONG
RECTL_lGetHeight(_In_ const RECTL * prcl)86 RECTL_lGetHeight(_In_ const RECTL* prcl)
87 {
88 return prcl->bottom - prcl->top;
89 }
90
91 FORCEINLINE
92 LONG
RECTL_lGetWidth(_In_ const RECTL * prcl)93 RECTL_lGetWidth(_In_ const RECTL* prcl)
94 {
95 return prcl->right - prcl->left;
96 }
97
98 BOOL
99 FASTCALL
100 RECTL_bUnionRect(
101 _Out_ RECTL *prclDst,
102 _In_ const RECTL *prcl1,
103 _In_ const RECTL *prcl2);
104
105 BOOL
106 FASTCALL
107 RECTL_bIntersectRect(
108 _Out_ RECTL* prclDst,
109 _In_ const RECTL* prcl1,
110 _In_ const RECTL* prcl2);
111
112 VOID
113 FASTCALL
114 RECTL_vMakeWellOrdered(
115 _Inout_ RECTL *prcl);
116
117 VOID
118 FASTCALL
119 RECTL_vInflateRect(
120 _Inout_ RECTL *rect,
121 _In_ INT dx,
122 _In_ INT dy);
123