summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2a6d1c5)
raw | patch | inline | side by side (parent: 2a6d1c5)
author | mental <mental@users.sourceforge.net> | |
Fri, 9 Mar 2007 01:46:33 +0000 (01:46 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Fri, 9 Mar 2007 01:46:33 +0000 (01:46 +0000) |
src/libnr/nr-rect.cpp | patch | blob | history |
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 9047e4e1c53faa2762b0bffe5b22aeea695800df..848d9b4f9900689b79ff86c39707d7090122d18d 100644 (file)
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
*/
#include "nr-rect-l.h"
+#include <algorithm>
NRRect::NRRect(NR::Rect const &rect)
: x0(rect.min()[NR::X]), y0(rect.min()[NR::Y]),
namespace NR {
Rect::Rect(const Point &p0, const Point &p1)
-: _min(MIN(p0[X], p1[X]), MIN(p0[Y], p1[Y])),
- _max(MAX(p0[X], p1[X]), MAX(p0[Y], p1[Y])) {}
+: _min(std::min(p0[X], p1[X]), std::min(p0[Y], p1[Y])),
+ _max(std::max(p0[X], p1[X]), std::max(p0[Y], p1[Y])) {}
/** returns the four corners of the rectangle in the correct winding order */
Point Rect::corner(unsigned i) const {
/** Makes this rectangle large enough to include the point p. */
void Rect::expandTo(Point p) {
for ( int i=0 ; i < 2 ; i++ ) {
- _min[i] = MIN(_min[i], p[i]);
- _max[i] = MAX(_max[i], p[i]);
+ _min[i] = std::min(_min[i], p[i]);
+ _max[i] = std::max(_max[i], p[i]);
}
}
} else {
Rect r;
for ( int i=0 ; i < 2 ; i++ ) {
- r._min[i] = MAX(a->_min[i], b->_min[i]);
- r._max[i] = MIN(a->_max[i], b->_max[i]);
+ r._min[i] = std::max(a->_min[i], b->_min[i]);
+ r._max[i] = std::min(a->_max[i], b->_max[i]);
if ( r._min[i] > r._max[i] ) {
return Nothing();
}
Rect union_bounds(Rect const &a, Rect const &b) {
Rect r;
for ( int i=0 ; i < 2 ; i++ ) {
- r._min[i] = MIN(a._min[i], b._min[i]);
- r._max[i] = MAX(a._max[i], b._max[i]);
+ r._min[i] = std::min(a._min[i], b._min[i]);
+ r._max[i] = std::max(a._max[i], b._max[i]);
}
return r;
}