Use std::min and std::max, not the misc versions.

This commit is contained in:
2025-08-10 17:08:42 -04:00
parent 6c3bf19bbd
commit 640ccd02d3
26 changed files with 216 additions and 226 deletions

View File

@ -59,11 +59,11 @@ bool Rectangle::intersectsWith (Rectangle *otherRect, Rectangle *dest)
otherRect->y < this->y + this->height;
if (doIntersect) {
dest->x = misc::max(this->x, otherRect->x);
dest->y = misc::max(this->y, otherRect->y);
dest->width = misc::min(this->x + this->width,
dest->x = std::max(this->x, otherRect->x);
dest->y = std::max(this->y, otherRect->y);
dest->width = std::min(this->x + this->width,
otherRect->x + otherRect->width) - dest->x;
dest->height = misc::min(this->y + this->height,
dest->height = std::min(this->y + this->height,
otherRect->y + otherRect->height) - dest->y;
} else {
dest->x = dest->y = dest->width = dest->height = 0;
@ -152,10 +152,10 @@ void Polygon::addPoint (int x, int y)
points.back().x = x;
points.back().y = y;
minx = misc::min(minx, x);
miny = misc::min(miny, y);
maxx = misc::max(maxx, x);
maxy = misc::max(maxy, y);
minx = std::min(minx, x);
miny = std::min(miny, y);
maxx = std::max(maxx, x);
maxy = std::max(maxy, y);
}
/**
@ -233,18 +233,18 @@ void Region::addRectangle (Rectangle *rPointer)
auto &ownRect= *it++;
int combinedHeight =
misc::max(r->y + r->height, ownRect->y + ownRect->height) -
misc::min(r->y, ownRect->y);
std::max(r->y + r->height, ownRect->y + ownRect->height) -
std::min(r->y, ownRect->y);
int combinedWidth =
misc::max(r->x + r->width, ownRect->x + ownRect->width) -
misc::min(r->x, ownRect->x);
std::max(r->x + r->width, ownRect->x + ownRect->width) -
std::min(r->x, ownRect->x);
if (rectangleList.size() >= 16 ||
combinedWidth * combinedHeight <=
ownRect->width * ownRect->height + r->width * r->height) {
r->x = misc::min(r->x, ownRect->x);
r->y = misc::min(r->y, ownRect->y);
r->x = std::min(r->x, ownRect->x);
r->y = std::min(r->y, ownRect->y);
r->width = combinedWidth;
r->height = combinedHeight;