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

@ -51,11 +51,11 @@ void Layout::LayoutImgRenderer::getRefArea (int *xRef, int *yRef, int *widthRef,
{
*xRef = 0;
*yRef = 0;
*widthRef = misc::max (layout->viewportWidth
*widthRef = std::max (layout->viewportWidth
- (layout->canvasHeightGreater ?
layout->vScrollbarThickness : 0),
layout->canvasWidth);
*heightRef = misc::max (layout->viewportHeight
*heightRef = std::max (layout->viewportHeight
- layout->hScrollbarThickness,
layout->canvasAscent + layout->canvasDescent);
}
@ -470,9 +470,9 @@ void Layout::attachView (View *view)
view->scrollTo (scrollX, scrollY);
view->setViewportSize (viewportWidth, viewportHeight,
hScrollbarThickness, vScrollbarThickness);
hScrollbarThickness = misc::max (hScrollbarThickness,
hScrollbarThickness = std::max (hScrollbarThickness,
view->getHScrollbarThickness ());
vScrollbarThickness = misc::max (vScrollbarThickness,
vScrollbarThickness = std::max (vScrollbarThickness,
view->getVScrollbarThickness ());
}
else {
@ -620,13 +620,13 @@ void Layout::scrollIdle ()
void Layout::adjustScrollPos ()
{
scrollX = misc::min (scrollX,
scrollX = std::min (scrollX,
canvasWidth - (viewportWidth - vScrollbarThickness));
scrollX = misc::max (scrollX, 0);
scrollX = std::max (scrollX, 0);
scrollY = misc::min (scrollY,
scrollY = std::min (scrollY,
canvasAscent + canvasDescent - (viewportHeight - hScrollbarThickness));
scrollY = misc::max (scrollY, 0);
scrollY = std::max (scrollY, 0);
_MSG("adjustScrollPos: scrollX=%d scrollY=%d\n", scrollX, scrollY);
}
@ -672,11 +672,11 @@ void Layout::draw (View *view, Rectangle *area)
area->height, 0, 0,
// Reference area: maximum of canvas size and
// viewport size.
misc::max (viewportWidth
std::max (viewportWidth
- (canvasHeightGreater ?
vScrollbarThickness : 0),
canvasWidth),
misc::max (viewportHeight
std::max (viewportHeight
- hScrollbarThickness,
canvasAscent + canvasDescent));
@ -994,11 +994,11 @@ void Layout::queueDrawExcept (int x, int y, int width, int height,
// Some or all of these may be empty.
// upper left corner of the intersection rectangle
int ix1 = misc::max (x, ex);
int iy1 = misc::max (y, ey);
int ix1 = std::max (x, ex);
int iy1 = std::max (y, ey);
// lower right corner of the intersection rectangle
int ix2 = misc::min (x + width, ex + ewidth);
int iy2 = misc::min (y + height, ey + eheight);
int ix2 = std::min (x + width, ex + ewidth);
int iy2 = std::min (y + height, ey + eheight);
queueDraw (x, y, width, iy1 - y);
queueDraw (x, iy2, width, y + height - iy2);
@ -1244,7 +1244,7 @@ bool Layout::processMouseEvent (MousePositionEvent *event,
if (event->yCanvas < scrollY)
event->yCanvas = scrollY;
else {
int maxY = misc::min(scrollY + viewportHeight -currHScrollbarThickness(),
int maxY = std::min(scrollY + viewportHeight -currHScrollbarThickness(),
canvasAscent + canvasDescent) - 1;
if (event->yCanvas > maxY)