2 * Copyright 2001-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
7 * Stephan Aßmus <superstippi@gmx.de>
19 IntPoint::ConstrainTo(const IntRect
& r
)
21 x
= max_c(min_c(x
, r
.right
), r
.left
);
22 y
= max_c(min_c(y
, r
.bottom
), r
.top
);
27 IntPoint::PrintToStream() const
29 printf("IntPoint(x:%" B_PRId32
", y:%" B_PRId32
")\n", x
, y
);
34 IntPoint::operator+(const IntPoint
& p
) const
36 return IntPoint(x
+ p
.x
, y
+ p
.y
);
41 IntPoint::operator-(const IntPoint
& p
) const
43 return IntPoint(x
- p
.x
, y
- p
.y
);
48 IntPoint::operator+=(const IntPoint
& p
)
58 IntPoint::operator-=(const IntPoint
& p
)
68 IntPoint::operator!=(const IntPoint
& p
) const
70 return x
!= p
.x
|| y
!= p
.y
;
75 IntPoint::operator==(const IntPoint
& p
) const
77 return x
== p
.x
&& y
== p
.y
;