-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMTypes.cpp
More file actions
42 lines (33 loc) · 708 Bytes
/
Copy pathMTypes.cpp
File metadata and controls
42 lines (33 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
///
/// MTypes.c
///
/// Generic replacements for very basic Mac types.
///
/// John Stiles, 2002/10/14
///
#include "stdafx.h"
#include "MTypes.h"
#include <algorithm>
using std::min;
using std::max;
void UnionMRect( const MRect* a, const MRect* b, MRect* u )
{
u->top = min( a->top, b->top );
u->left = min( a->left, b->left );
u->bottom = max( a->bottom, b->bottom );
u->right = max( a->right, b->right );
}
void OffsetMRect( MRect* r, int x, int y )
{
r->top += y;
r->left += x;
r->bottom += y;
r->right += x;
}
unsigned char MPointInMRect( MPoint p, MRect* r )
{
return (p.h >= r->left) &&
(p.h < r->right) &&
(p.v >= r->top) &&
(p.v < r->bottom);
}