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

@ -37,8 +37,8 @@ Bullet::~Bullet ()
void Bullet::sizeRequestSimpl (core::Requisition *requisition)
{
requisition->width = lout::misc::max (getStyle()->font->xHeight * 4 / 5, 1);
requisition->ascent = lout::misc::max (getStyle()->font->xHeight, 1);
requisition->width = std::max (getStyle()->font->xHeight * 4 / 5, 1);
requisition->ascent = std::max (getStyle()->font->xHeight, 1);
requisition->descent = 0;
}
@ -46,7 +46,7 @@ void Bullet::getExtremesSimpl (core::Extremes *extremes)
{
extremes->minWidth = extremes->maxWidth = extremes->adjustmentWidth =
extremes->minWidthIntrinsic = extremes->maxWidthIntrinsic =
lout::misc::max (getStyle()->font->xHeight * 4 / 5, 1);
std::max (getStyle()->font->xHeight * 4 / 5, 1);
}
void Bullet::containerSizeChangedForChildren ()
@ -62,7 +62,7 @@ void Bullet::draw (core::View *view, core::Rectangle *area,
int x, y, l;
bool filled = true;
l = lout::misc::min (allocation.width, allocation.ascent);
l = std::min (allocation.width, allocation.ascent);
x = allocation.x;
y = allocation.y + allocation.ascent - getStyle()->font->xHeight;

View File

@ -327,9 +327,9 @@ inline void FltkImgbuf::scaleBuffer (const core::byte *src, int srcWidth,
for(int x = 0; x < destWidth; x++) {
for(int y = 0; y < destHeight; y++) {
int xo1 = x * srcWidth / destWidth;
int xo2 = lout::misc::max ((x + 1) * srcWidth / destWidth, xo1 + 1);
int xo2 = std::max ((x + 1) * srcWidth / destWidth, xo1 + 1);
int yo1 = y * srcHeight / destHeight;
int yo2 = lout::misc::max ((y + 1) * srcHeight / destHeight, yo1 + 1);
int yo2 = std::max ((y + 1) * srcHeight / destHeight, yo1 + 1);
int n = (xo2 - xo1) * (yo2 - yo1);
for(int i = 0; i < bpp; i++)
@ -489,8 +489,8 @@ void FltkImgbuf::copyTo (Imgbuf *dest, int xDestRoot, int yDestRoot,
FltkImgbuf *fDest = (FltkImgbuf*)dest;
assert (bpp == fDest->bpp);
int xSrc2 = lout::misc::min (xSrc + widthSrc, fDest->width - xDestRoot);
int ySrc2 = lout::misc::min (ySrc + heightSrc, fDest->height - yDestRoot);
int xSrc2 = std::min (xSrc + widthSrc, fDest->width - xDestRoot);
int ySrc2 = std::min (ySrc + heightSrc, fDest->height - yDestRoot);
//printf ("copying from (%d, %d), %d x %d to (%d, %d) (root) => "
// "xSrc2 = %d, ySrc2 = %d\n",

View File

@ -118,7 +118,7 @@ FltkFont::FltkFont (core::style::FontAttrs *attrs)
fl_font(font, size);
// WORKAROUND: A bug with fl_width(uint_t) on non-xft X was present in
// 1.3.0 (STR #2688).
spaceWidth = misc::max(0, (int)fl_width(" ") + letterSpacing);
spaceWidth = std::max(0, (int)fl_width(" ") + letterSpacing);
int xx, xy, xw, xh;
fl_text_extents("x", xx, xy, xw, xh);
xHeight = xh;

View File

@ -486,11 +486,11 @@ void FltkViewport::scrollTo (int x, int y)
int hdiff = vscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
int vdiff = hscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
x = misc::min (x, canvasWidth - w() + hdiff);
x = misc::max (x, 0);
x = std::min (x, canvasWidth - w() + hdiff);
x = std::max (x, 0);
y = misc::min (y, canvasHeight - h() + vdiff);
y = misc::max (y, 0);
y = std::min (y, canvasHeight - h() + vdiff);
y = std::max (y, 0);
if (x == scrollX && y == scrollY) {
return;

View File

@ -317,7 +317,7 @@ void Hyphenator::hyphenateSingleWord(core::Platform *platform,
if (p) {
for (int k = 0; p[k]; k++)
points.set(i + k,
lout::misc::max (points.get (i + k), p[k] - '0'));
std::max (points.get (i + k), p[k] - '0'));
}
}
}
@ -352,7 +352,7 @@ void Hyphenator::hyphenateSingleWord(core::Platform *platform,
}
// Examine the points to build the break point list.
int n = lout::misc::min ((int)strlen (wordLc), points.size () - 2);
int n = std::min ((int)strlen (wordLc), points.size () - 2);
for (int i = 0; i < n; i++) {
if (points.get(i + 2) % 2) {
breakPos->increase ();

View File

@ -244,7 +244,7 @@ void Image::getExtremesSimpl (core::Extremes *extremes)
correctExtremes (extremes, false);
extremes->adjustmentWidth =
misc::min (extremes->minWidthIntrinsic, extremes->minWidth);
std::min (extremes->minWidthIntrinsic, extremes->minWidth);
}
void Image::sizeAllocateImpl (core::Allocation *allocation)
@ -330,7 +330,7 @@ int Image::contentX (core::MousePositionEvent *event)
{
int ret = event->xWidget - boxOffsetX();
ret = misc::min(getContentWidth(), misc::max(ret, 0));
ret = std::min(getContentWidth(), std::max(ret, 0));
return ret;
}
@ -338,7 +338,7 @@ int Image::contentY (core::MousePositionEvent *event)
{
int ret = event->yWidget - boxOffsetY();
ret = misc::min(getContentHeight(), misc::max(ret, 0));
ret = std::min(getContentHeight(), std::max(ret, 0));
return ret;
}

View File

@ -135,10 +135,10 @@ void Iterator::scrollTo (Iterator *it1, Iterator *it2, int start, int end,
curEnd = INT_MAX;
eit3->getAllocation (curStart, curEnd, &alloc);
x1 = misc::min (x1, alloc.x);
x2 = misc::max (x2, alloc.x + alloc.width);
y1 = misc::min (y1, alloc.y);
y2 = misc::max (y2, alloc.y + alloc.ascent + alloc.descent);
x1 = std::min (x1, alloc.x);
x2 = std::max (x2, alloc.x + alloc.width);
y1 = std::min (y1, alloc.y);
y2 = std::max (y2, alloc.y + alloc.ascent + alloc.descent);
}
delete eit3;

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)

View File

@ -258,7 +258,7 @@ void OOFAwareWidget::correctRequisitionByOOF (Requisition *requisition,
if (oofWidth > requisition->width) {
if (outOfFlowMgr[i]->containerMustAdjustExtraSpace () &&
adjustExtraSpaceWhenCorrectingRequisitionByOOF ()) {
extraSpace.right = max (extraSpace.right,
extraSpace.right = std::max (extraSpace.right,
oofWidth - requisition->width);
DBG_OBJ_SET_NUM ("extraSpace.right", extraSpace.right);
}
@ -269,7 +269,7 @@ void OOFAwareWidget::correctRequisitionByOOF (Requisition *requisition,
if (oofHeight > requisition->ascent + requisition->descent) {
if (outOfFlowMgr[i]->containerMustAdjustExtraSpace () &&
adjustExtraSpaceWhenCorrectingRequisitionByOOF ()) {
extraSpace.bottom = max (extraSpace.bottom,
extraSpace.bottom = std::max (extraSpace.bottom,
oofHeight - (requisition->ascent +
requisition->descent));
DBG_OBJ_SET_NUM ("extraSpace.bottom", extraSpace.bottom);
@ -280,7 +280,7 @@ void OOFAwareWidget::correctRequisitionByOOF (Requisition *requisition,
}
if (!adjustExtraSpaceWhenCorrectingRequisitionByOOF ()) {
requisitionWithoutOOF.width = max (requisitionWithoutOOF.width,
requisitionWithoutOOF.width = std::max (requisitionWithoutOOF.width,
oofWidth);
if (oofHeight >
requisitionWithoutOOF.ascent + requisitionWithoutOOF.descent)
@ -321,13 +321,13 @@ void OOFAwareWidget::correctExtremesByOOF (Extremes *extremes)
DBG_OBJ_MSGF ("resize", 1, "result: %d / %d",
oofMinWidth, oofMaxWidth);
extremes->minWidth = max (extremes->minWidth, oofMinWidth);
extremes->minWidthIntrinsic = max (extremes->minWidthIntrinsic,
extremes->minWidth = std::max (extremes->minWidth, oofMinWidth);
extremes->minWidthIntrinsic = std::max (extremes->minWidthIntrinsic,
oofMinWidth);
extremes->maxWidth = max (extremes->maxWidth, oofMaxWidth);
extremes->maxWidthIntrinsic = max (extremes->maxWidthIntrinsic,
extremes->maxWidth = std::max (extremes->maxWidth, oofMaxWidth);
extremes->maxWidthIntrinsic = std::max (extremes->maxWidthIntrinsic,
oofMinWidth);
extremes->adjustmentWidth = max (extremes->adjustmentWidth,
extremes->adjustmentWidth = std::max (extremes->adjustmentWidth,
oofMinWidth);
DBG_OBJ_MSGF ("resize", 1, "after correction: %d (%d) / %d (%d)",

View File

@ -447,7 +447,7 @@ int OOFFloatsMgr::calcFloatX (Float *vloat)
// it is corrected (but not left of the container). This way, we save
// space and, especially within tables, avoid some problems.
if (x + vloat->size.width > container->getMaxGeneratorWidth ())
x = max (0, container->getMaxGeneratorWidth () - vloat->size.width);
x = std::max (0, container->getMaxGeneratorWidth () - vloat->size.width);
break;
case FLOAT_RIGHT:
@ -475,10 +475,10 @@ int OOFFloatsMgr::calcFloatX (Float *vloat)
// (ii) If there is more than one line, the line break will already be
// exceeded, and so be smaller that GB width + float width.
effGeneratorWidth =
min (vloat->generator->getGeneratorWidth () + vloat->size.width,
std::min (vloat->generator->getGeneratorWidth () + vloat->size.width,
vloat->generator->getMaxGeneratorWidth ());
x = max (generator->getGeneratorX (oofmIndex) + effGeneratorWidth
x = std::max (generator->getGeneratorX (oofmIndex) + effGeneratorWidth
- vloat->size.width - generator->getStyle()->boxRestWidth(),
// Do not exceed container allocation:
0);
@ -959,9 +959,9 @@ void OOFFloatsMgr::getSize (Requisition *cbReq, int *oofWidth, int *oofHeight)
// boxRestHeight() are added here.
*oofWidth =
max (oofWidthtLeft, oofWidthRight) + container->boxRestWidth ();
std::max (oofWidthtLeft, oofWidthRight) + container->boxRestWidth ();
*oofHeight =
max (oofHeightLeft, oofHeightRight) + container->boxRestHeight ();
std::max (oofHeightLeft, oofHeightRight) + container->boxRestHeight ();
SizeChanged = true;
@ -994,8 +994,8 @@ void OOFFloatsMgr::getFloatsSize (Requisition *cbReq, Side side, int *width,
ensureFloatSize (vloat);
*width = max (*width, calcFloatX (vloat) + vloat->size.width);
*height = max (*height,
*width = std::max (*width, calcFloatX (vloat) + vloat->size.width);
*height = std::max (*height,
vloat->yReal + vloat->size.ascent + vloat->size.descent);
}
@ -1017,8 +1017,8 @@ void OOFFloatsMgr::getExtremes (Extremes *cbExtr, int *oofMinWidth,
getFloatsExtremes (cbExtr, LEFT, &oofMinWidthtLeft, &oofMaxWidthLeft);
getFloatsExtremes (cbExtr, RIGHT, &oofMinWidthRight, &oofMaxWidthRight);
*oofMinWidth = max (oofMinWidthtLeft, oofMinWidthRight);
*oofMaxWidth = max (oofMaxWidthLeft, oofMaxWidthRight);
*oofMinWidth = std::max (oofMinWidthtLeft, oofMinWidthRight);
*oofMaxWidth = std::max (oofMaxWidthLeft, oofMaxWidthRight);
DBG_OBJ_MSGF ("resize.oofm", 1,
"=> (l: %d, r: %d => %d) / (l: %d, r: %d => %d)",
@ -1059,13 +1059,13 @@ void OOFFloatsMgr::getFloatsExtremes (Extremes *cbExtr, Side side,
// - This is also the case for the left border, as seen in calcFloatX()
// ("... but when the float exceeds the line break width" ...).
*minWidth = max (*minWidth, extr.minWidth);
*minWidth = std::max (*minWidth, extr.minWidth);
// For the maximal width, borders must be considered.
*maxWidth = max (*maxWidth,
*maxWidth = std::max ( std::max(*maxWidth,
extr.maxWidth
+ vloat->generator->getStyle()->boxDiffWidth(),
+ max (container->getGeneratorWidth ()
+ vloat->generator->getStyle()->boxDiffWidth() ) ,
+ std::max (container->getGeneratorWidth ()
- vloat->generator->getGeneratorWidth (),
0));
@ -1171,7 +1171,7 @@ int OOFFloatsMgr::getBorder (Side side, int y, int h, OOFAwareWidget *lastGB,
DBG_OBJ_MSGF ("border", 1, "thisBorder = %d + %d = %d",
vloat->size.width, d, thisBorder);
border = max (border, thisBorder);
border = std::max (border, thisBorder);
}
}
}
@ -1265,7 +1265,7 @@ int OOFFloatsMgr::getClearPosition (OOFAwareWidget *widget)
default: assertNotReached ();
}
pos = max (left ? getClearPosition (widget, LEFT) : 0,
pos = std::max (left ? getClearPosition (widget, LEFT) : 0,
right ? getClearPosition (widget, RIGHT) : 0);
} else
pos = 0;
@ -1306,7 +1306,7 @@ int OOFFloatsMgr::getClearPosition (OOFAwareWidget *widget, Side side)
assert (vloat->generator != widget);
ensureFloatSize (vloat);
int yRel = widget->getGeneratorY (oofmIndex);
pos = max (vloat->yReal + vloat->size.ascent + vloat->size.descent - yRel,
pos = std::max (vloat->yReal + vloat->size.ascent + vloat->size.descent - yRel,
0);
DBG_OBJ_MSGF ("resize.oofm", 1, "pos = max (%d + %d + %d - %d, 0)",
vloat->yReal, vloat->size.ascent, vloat->size.descent,

View File

@ -90,9 +90,9 @@ void OOFPosAbsLikeMgr::getSize (Requisition *containerReq, int *oofWidth,
int x, y, width, ascent, descent;
calcPosAndSizeChildOfChild (child, refWidth, refHeight, &x, &y, &width,
&ascent, &descent);
*oofWidth = max (*oofWidth, x + width) + containerBoxDiffWidth ();
*oofWidth = std::max (*oofWidth, x + width) + containerBoxDiffWidth ();
*oofHeight =
max (*oofHeight, y + ascent + descent) + containerBoxDiffHeight ();
std::max (*oofHeight, y + ascent + descent) + containerBoxDiffHeight ();
child->consideredForSize = true;
} else
@ -135,11 +135,11 @@ void OOFPosAbsLikeMgr::getExtremes (Extremes *containerExtr, int *oofMinWidth,
calcHPosAndSizeChildOfChild (child, containerExtr->minWidth,
childExtr.minWidth, &x, &width);
*oofMinWidth = max (*oofMinWidth, x + width);
*oofMinWidth = std::max (*oofMinWidth, x + width);
calcHPosAndSizeChildOfChild (child, containerExtr->maxWidth,
childExtr.maxWidth, &x, &width);
*oofMaxWidth = max (*oofMaxWidth, x + width);
*oofMaxWidth = std::max (*oofMaxWidth, x + width);
child->consideredForExtremes = true;
} else
@ -174,7 +174,7 @@ int OOFPosAbsLikeMgr::getAvailWidthOfChild (Widget *child, bool forceValue)
if (!getPosLeft (child, availWidth, &left)) left = 0;
if (!getPosRight (child, availWidth, &right)) right = 0;
width = max (availWidth - containerBoxDiffWidth () - left - right, 0);
width = std::max (availWidth - containerBoxDiffWidth () - left - right, 0);
} else
width = -1;
} else {
@ -188,7 +188,7 @@ int OOFPosAbsLikeMgr::getAvailWidthOfChild (Widget *child, bool forceValue)
}
if (width != -1)
width = max (width, child->getMinWidth (NULL, forceValue));
width = std::max (width, child->getMinWidth (NULL, forceValue));
DBG_OBJ_MSGF ("resize.oofm", 1, "=> %d", width);
DBG_OBJ_LEAVE ();
@ -218,7 +218,7 @@ int OOFPosAbsLikeMgr::getAvailHeightOfChild (Widget *child, bool forceValue)
if (!getPosBottom (child, availHeight, &bottom)) bottom = 0;
height =
max (availHeight - containerBoxDiffHeight () - top - bottom, 0);
std::max (availHeight - containerBoxDiffHeight () - top - bottom, 0);
} else
height = -1;
} else {

View File

@ -114,8 +114,8 @@ void OOFPosRelMgr::getSize (Requisition *containerReq, int *oofWidth,
if (posXDefined (child) && posYDefined (child)) {
Requisition childReq;
child->widget->sizeRequest (&childReq);
*oofWidth = max (*oofWidth, getChildPosX (child) + childReq.width);
*oofHeight = max (*oofHeight,
*oofWidth = std::max (*oofWidth, getChildPosX (child) + childReq.width);
*oofHeight = std::max (*oofHeight,
getChildPosY (child) + childReq.ascent
+ childReq.descent);
@ -144,10 +144,10 @@ void OOFPosRelMgr::getExtremes (Extremes *containerExtr, int *oofMinWidth,
// Put the extremes of the container in relation to the extremes
// of the child, as in OOFPosAbsLikeMgr::getExtremes (see
// comment there).
*oofMinWidth = max (*oofMinWidth,
*oofMinWidth = std::max (*oofMinWidth,
getChildPosX (child, containerExtr->minWidth)
+ childExtr.minWidth);
*oofMaxWidth = max (*oofMaxWidth,
*oofMaxWidth = std::max (*oofMaxWidth,
getChildPosX (child, containerExtr->maxWidth)
+ childExtr.maxWidth);

View File

@ -39,7 +39,7 @@ Ruler::~Ruler ()
void Ruler::sizeRequestSimpl (core::Requisition *requisition)
{
requisition->width = lout::misc::max (getAvailWidth (true), boxDiffWidth ());
requisition->width = std::max (getAvailWidth (true), boxDiffWidth ());
requisition->ascent = boxOffsetY ();
requisition->descent = boxRestHeight ();
}
@ -51,7 +51,7 @@ void Ruler::getExtremesSimpl (core::Extremes *extremes)
extremes->maxWidthIntrinsic = extremes->maxWidth;
correctExtremes (extremes, false);
extremes->adjustmentWidth =
lout::misc::min (extremes->minWidthIntrinsic, extremes->minWidth);
std::min (extremes->minWidthIntrinsic, extremes->minWidth);
}
bool Ruler::isBlockLevel ()

View File

@ -363,7 +363,7 @@ int SelectionState::correctCharPos (DeepIterator *it, int charPos)
else
len = 1;
return misc::min(charPos, len);
return std::min(charPos, len);
}
void SelectionState::highlight0 (bool fl, DeepIterator *from, int fromChar,

View File

@ -1,3 +1,4 @@
static_assert( __cplusplus > 2020'02 );
/*
* Dillo Widget
*
@ -23,6 +24,8 @@
#include <ctype.h>
#include <math.h>
#include <algorithm>
#include "dlib/dlib.h"
#include "core.hh"
#include "../lout/msg.h"
@ -475,7 +478,7 @@ int Color::shadeColor (int color, int d)
int green = (color >> 8) & 255;
int blue = color & 255;
double oldLightness = ((double) misc::max (red, green, blue)) / 255;
double oldLightness = ( (double) std::max( red, std::max( green, blue ) ) ) / 255;
double newLightness;
if (oldLightness > 0.8) {
@ -569,9 +572,9 @@ void StyleImage::StyleImgRenderer::setBuffer (core::Imgbuf *buffer, bool resize)
if (image->imgbufSrc->getRootWidth() * image->imgbufSrc->getRootHeight()
< MIN_BG_IMG_W * MIN_BG_IMG_H) {
image->tilesX =
misc::max (OPT_BG_IMG_W / image->imgbufSrc->getRootWidth(), 1);
std::max (OPT_BG_IMG_W / image->imgbufSrc->getRootWidth(), 1);
image->tilesY =
misc::max (OPT_BG_IMG_H / image->imgbufSrc->getRootHeight(), 1);
std::max (OPT_BG_IMG_H / image->imgbufSrc->getRootHeight(), 1);
image->imgbufTiled =
image->imgbufSrc->createSimilarBuf
(image->tilesX * image->imgbufSrc->getRootWidth(),
@ -685,8 +688,8 @@ void StyleImage::ExternalImgRenderer::drawRow (int row)
// Only iterate over y, because the rows can be combined
// horizontally.
for (int tileY = tileY1; tileY <= tileY2; tileY++) {
int x1 = misc::max (origX + tileX1 * imgWidth, x);
int x2 = misc::min (origX + (tileX2 + 1) * imgWidth, x + width);
int x1 = std::max (origX + tileX1 * imgWidth, x);
int x2 = std::min (origX + (tileX2 + 1) * imgWidth, x + width);
int yt = origY + tileY * imgHeight + row;
if (yt >= y && yt < y + height)
@ -1325,11 +1328,11 @@ void drawBackgroundImage (View *view, StyleImage *backgroundImage,
for (int tileX = tileX1; tileX <= tileX2; tileX += tilesX)
for (int tileY = tileY1; tileY <= tileY2; tileY += tilesY) {
int xt = origX + tileX * imgWidthS;
int x1 = misc::max (xt, x);
int x2 = misc::min (xt + imgWidthT, x + width);
int x1 = std::max (xt, x);
int x2 = std::min (xt + imgWidthT, x + width);
int yt = origY + tileY * imgHeightS;
int y1 = misc::max (yt, y);
int y2 = misc::min (yt + imgHeightT, y + height);
int y1 = std::max (yt, y);
int y2 = std::min (yt + imgHeightT, y + height);
view->drawImage (imgbufT, xt, yt, x1 - xt, y1 - yt,
x2 - x1, y2 - y1);

View File

@ -296,7 +296,7 @@ int Table::calcAvailWidthForDescendant (Widget *child)
int width = (colspanEff - 1) * getStyle()->hBorderSpacing;
for (int i = 0; i < colspanEff; i++)
width += colWidths->get (col + i);
width = misc::max (width, 0);
width = std::max (width, 0);
if (child != actualChild) {
// For table cells (direct children: child == actualChild), CSS
@ -308,7 +308,7 @@ int Table::calcAvailWidthForDescendant (Widget *child)
child->calcFinalWidth (child->getStyle(), -1, this, 0, true, &corrWidth);
// But better not exceed it ... (TODO: Only here?)
width = misc::min (width, corrWidth);
width = std::min (width, corrWidth);
}
DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
@ -496,7 +496,7 @@ void Table::addCell (Widget *widget, int colspan, int rowspan)
}
if (colspan == 0) {
colspanEff = misc::max (numCols - curCol, 1);
colspanEff = std::max (numCols - curCol, 1);
rowClosed = true;
} else
colspanEff = colspan;
@ -654,10 +654,10 @@ int Table::getExtreme (core::Extremes *extremes, ExtrMod mod)
return extremes->minWidthIntrinsic;
case MIN_MIN:
return misc::min (extremes->minWidth, extremes->minWidthIntrinsic);
return std::min (extremes->minWidth, extremes->minWidthIntrinsic);
case MAX_MIN:
return misc::max (extremes->minWidth, extremes->minWidthIntrinsic);
return std::max (extremes->minWidth, extremes->minWidthIntrinsic);
case MAX:
return extremes->maxWidth;
@ -915,7 +915,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
// width for correction. (TODO: Is this necessary?)
int corrWidth =
Table::getAdjustTableMinWidth () ? extremes.adjustmentWidth : 0;
int totalWidth = misc::max (availWidth, corrWidth)
int totalWidth = std::max (availWidth, corrWidth)
- ((numCols + 1) * getStyle()->hBorderSpacing + boxDiffWidth ());
DBG_OBJ_MSGF ("resize", 1,
@ -1144,7 +1144,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
} else {
// Normal apportioning.
int width =
totalWidthSpecified ? totalWidth : misc::min (totalWidth, maxWidth);
totalWidthSpecified ? totalWidth : std::min (totalWidth, maxWidth);
DBG_OBJ_MSGF ("resize", 1, "case 3: else; width = %d", width);
apportion2 (width, 0, colExtremes->size() - 1, MIN, MAX, NULL, colWidths,
0);
@ -1155,7 +1155,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
// performance gain actually play a role?
for (int col = 0; col < colExtremes->size(); col++) {
if (colWidths->get (col) != oldColWidths->get (col))
redrawX = lout::misc::min (redrawX, colWidths->get (col));
redrawX = std::min (redrawX, colWidths->get (col));
}
DBG_IF_RTFL {
@ -1208,7 +1208,7 @@ void Table::actuallyCalcCellSizes (bool calcHeights)
children->get(n)->cell.widget->sizeRequest (&childRequisition);
childHeight = childRequisition.ascent + childRequisition.descent;
if (children->get(n)->cell.rowspan == 1) {
rowHeight = misc::max (rowHeight, childHeight);
rowHeight = std::max (rowHeight, childHeight);
} else {
rowSpanCells->increase();
rowSpanCells->set(rowSpanCells->size()-1, n);
@ -1330,23 +1330,23 @@ void Table::forceCalcColumnExtremes ()
cellExtremes.minWidth, cellExtremes.maxWidth);
colExtremes->getRef(col)->minWidthIntrinsic =
misc::max (colExtremes->getRef(col)->minWidthIntrinsic,
std::max (colExtremes->getRef(col)->minWidthIntrinsic,
cellExtremes.minWidthIntrinsic);
colExtremes->getRef(col)->maxWidthIntrinsic =
misc::max (colExtremes->getRef(col)->minWidthIntrinsic,
colExtremes->getRef(col)->maxWidthIntrinsic,
cellExtremes.maxWidthIntrinsic);
std::max( colExtremes->getRef(col)->minWidthIntrinsic,
std::max( colExtremes->getRef(col)->maxWidthIntrinsic,
cellExtremes.maxWidthIntrinsic ) );
colExtremes->getRef(col)->minWidth =
misc::max (colExtremes->getRef(col)->minWidth,
std::max (colExtremes->getRef(col)->minWidth,
cellExtremes.minWidth);
colExtremes->getRef(col)->maxWidth =
misc::max (colExtremes->getRef(col)->minWidth,
colExtremes->getRef(col)->maxWidth,
cellExtremes.maxWidth);
std::max( colExtremes->getRef(col)->minWidth,
std::max( colExtremes->getRef(col)->maxWidth,
cellExtremes.maxWidth ) );
colExtremes->getRef(col)->adjustmentWidth =
misc::max (colExtremes->getRef(col)->adjustmentWidth,
std::max (colExtremes->getRef(col)->adjustmentWidth,
cellExtremes.adjustmentWidth);
core::style::Length childWidth =
@ -1487,7 +1487,7 @@ void Table::calcExtremesSpanMultiCols (int col, int cs,
// For cases where min and max are somewhat confused:
setColExtreme (col + j, maxExtrMod, extrData,
misc::max (getColExtreme (col + j, minExtrMod,
std::max (getColExtreme (col + j, minExtrMod,
extrData),
getColExtreme (col + j, maxExtrMod,
extrData)));

View File

@ -458,7 +458,7 @@ private:
void setCumHeight (int row, int value)
{
if (value != cumHeight->get (row)) {
redrawY = lout::misc::min ( redrawY, value );
redrawY = std::min ( redrawY, value );
cumHeight->set (row, value);
}
}

View File

@ -57,11 +57,7 @@ int correctAvailWidthOfChild (core::Widget *widget, core::Widget *child,
int thisWidth = widget->getAvailWidth (forceValue);
DBG_OBJ_MSGF_O ("resize", 1, widget, "thisWidth = %d", thisWidth);
if (thisWidth != -1)
width =
lout::misc::max (lout::misc::min (width,
thisWidth
- widget->boxDiffWidth ()),
0);
width = std::max (std::min (width, thisWidth - widget->boxDiffWidth ()), 0);
}
DBG_OBJ_MSGF_O ("resize", 1, widget, "=> %d", width);
@ -96,11 +92,10 @@ void correctCorrectedRequisitionOfChild (core::Widget *widget,
int thisWidth = widget->getAvailWidth (true);
DBG_OBJ_MSGF_O ("resize", 1, widget, "thisWidth = %d", thisWidth);
int newWidth =
lout::misc::max (lout::misc::min (requisition->width,
std::max (std::min (requisition->width,
thisWidth - widget->boxDiffWidth ()),
0);
requisition->width = allowDecreaseWidth ?
newWidth : misc::max (requisition->width, newWidth);
requisition->width = allowDecreaseWidth ? newWidth : std::max (requisition->width, newWidth);
DBG_OBJ_LEAVE_O (widget);
}

View File

@ -603,7 +603,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
//
// TODO: test case?
calcTextOffset (lineIndex, misc::min (allocation->width, lineBreakWidth));
calcTextOffset (lineIndex, std::min (allocation->width, lineBreakWidth));
line = lines->getRef (lineIndex);
xCursor = line->textOffset;
@ -615,7 +615,7 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
word = words->getRef (wordIndex);
if (wordIndex == lastWordDrawn + 1) {
redrawY = misc::min (redrawY, lineYOffsetWidget (line, allocation));
redrawY = std::min (redrawY, lineYOffsetWidget (line, allocation));
DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
@ -652,10 +652,10 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
* so we need to redraw from this line onwards.
*/
redrawY =
misc::min (redrawY, lineYOffsetWidget (line, allocation));
std::min (redrawY, lineYOffsetWidget (line, allocation));
DBG_OBJ_SET_NUM ("redrawY", redrawY);
if (word->content.widget->wasAllocated ()) {
redrawY = misc::min (redrawY,
redrawY = std::min (redrawY,
oldChildAllocation->y - this->allocation.y);
DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
@ -680,17 +680,17 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation)
core::Content::BREAK)) {
int childChangedY =
misc::min(childAllocation.y - allocation->y +
std::min(childAllocation.y - allocation->y +
childAllocation.ascent + childAllocation.descent,
oldChildAllocation->y - this->allocation.y +
oldChildAllocation->ascent +
oldChildAllocation->descent);
redrawY = misc::min (redrawY, childChangedY);
redrawY = std::min (redrawY, childChangedY);
DBG_OBJ_SET_NUM ("redrawY", redrawY);
} else {
redrawY =
misc::min (redrawY, lineYOffsetWidget (line, allocation));
std::min (redrawY, lineYOffsetWidget (line, allocation));
DBG_OBJ_SET_NUM ("redrawY", redrawY);
}
}
@ -742,10 +742,10 @@ void Textblock::calcExtraSpaceImpl (int numPos, Widget **references, int *x,
for (int i = 0; i < NUM_OOFM; i++)
if (searchOutOfFlowMgr (i) && findSizeRequestReference (i, NULL, NULL))
clearPosition =
misc::max (clearPosition,
std::max (clearPosition,
searchOutOfFlowMgr(i)->getClearPosition (this));
extraSpace.top = misc::max (extraSpace.top, clearPosition);
extraSpace.top = std::max (extraSpace.top, clearPosition);
DBG_OBJ_LEAVE ();
}
@ -767,7 +767,7 @@ int Textblock::getAvailWidthOfChild (Widget *child, bool forceValue)
// there), but "leftInnerPadding" has to be considered, too.
DBG_OBJ_MSG ("resize", 1, "no specification");
if (forceValue) {
width = misc::max (getAvailWidth (true) - boxDiffWidth ()
width = std::max (getAvailWidth (true) - boxDiffWidth ()
- leftInnerPadding,
0);
@ -889,7 +889,7 @@ void Textblock::markSizeChange (int ref)
if (wrapRefLines == -1)
wrapRefLines = getParentRefInFlowSubRef (ref);
else
wrapRefLines = misc::min (wrapRefLines,
wrapRefLines = std::min (wrapRefLines,
getParentRefInFlowSubRef (ref));
}
@ -924,7 +924,7 @@ void Textblock::markExtremesChange (int ref)
wrapRefParagraphs = getParentRefInFlowSubRef (ref);
else
wrapRefParagraphs =
misc::min (wrapRefParagraphs, getParentRefInFlowSubRef (ref));
std::min (wrapRefParagraphs, getParentRefInFlowSubRef (ref));
}
DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs);
@ -1368,7 +1368,7 @@ void Textblock::drawWord0 (int wordIndex1, int wordIndex2,
firstCharIdx = 0;
else {
firstCharIdx =
misc::min (hlStart[layer].nChar,
std::min (hlStart[layer].nChar,
(int)strlen (words->getRef(hlStart[layer].index)
->content.text));
for (int i = wordIndex1; i < hlStart[layer].index; i++)
@ -1381,7 +1381,7 @@ void Textblock::drawWord0 (int wordIndex1, int wordIndex2,
lastCharIdx = wordLen;
else {
lastCharIdx =
misc::min (hlEnd[layer].nChar,
std::min (hlEnd[layer].nChar,
(int)strlen (words->getRef(hlEnd[layer].index)
->content.text));
for (int i = wordIndex1; i < hlEnd[layer].index; i++)
@ -2008,10 +2008,10 @@ void Textblock::calcTextSize (const char *text, size_t len,
*/
if (style->valign == core::style::VALIGN_SUB) {
int requiredDescent = style->font->descent + style->font->ascent / 3;
size->descent = misc::max (size->descent, requiredDescent);
size->descent = std::max (size->descent, requiredDescent);
} else if (style->valign == core::style::VALIGN_SUPER) {
int requiredAscent = style->font->ascent + style->font->ascent / 2;
size->ascent = misc::max (size->ascent, requiredAscent);
size->ascent = std::max (size->ascent, requiredAscent);
}
}
@ -2335,7 +2335,7 @@ bool Textblock::calcSizeOfWidgetInFlow (int wordIndex, Widget *widget,
int rightBorder = boxRestWidth ();
int lastMargin, yLine = yOffsetOfLineToBeCreated (&lastMargin);
int yRel = yLine - min (lastMargin, widget->getStyle()->margin.top);
int yRel = yLine - std::min (lastMargin, widget->getStyle()->margin.top);
DBG_OBJ_MSGF ("resize", 1,
"leftBorder = %d + %d + (%d == 0 ? %d : 0) = %d, "
@ -2804,10 +2804,10 @@ void Textblock::addParbreak (int space, core::style::Style *style)
Line *lastLine = lines->getRef (lines->size () - 1);
word->content.breakSpace =
misc::max (word->content.breakSpace, space);
std::max (word->content.breakSpace, space);
lastLine->breakSpace =
misc::max (word->content.breakSpace,
lastLine->marginDescent - lastLine->borderDescent,
std::max( std::max( word->content.breakSpace,
lastLine->marginDescent - lastLine->borderDescent ),
lastLine->breakSpace);
return;
}
@ -3048,13 +3048,13 @@ void Textblock::queueDrawRange (int index1, int index2)
{
DBG_OBJ_ENTER ("draw", 0, "queueDrawRange", "%d, %d", index1, index2);
int from = misc::min (index1, index2);
int to = misc::max (index1, index2);
int from = std::min (index1, index2);
int to = std::max (index1, index2);
from = misc::min (from, words->size () - 1);
from = misc::max (from, 0);
to = misc::min (to, words->size () - 1);
to = misc::max (to, 0);
from = std::min (from, words->size () - 1);
from = std::max (from, 0);
to = std::min (to, words->size () - 1);
to = std::max (to, 0);
int line1idx = findLineOfWord (from);
int line2idx = findLineOfWord (to);
@ -3193,7 +3193,7 @@ int Textblock::getGeneratorWidth ()
word->content.type == core::Content::WIDGET_IN_FLOW &&
( tbChild= dynamic_cast< Textblock * >( word->content.widget ) )) {
if(tbChild->findSizeRequestReference(this, &xRel, NULL))
wChild = max(wChild, xRel + tbChild->getGeneratorWidth());
wChild = std::max(wChild, xRel + tbChild->getGeneratorWidth());
}
}
@ -3201,11 +3201,11 @@ int Textblock::getGeneratorWidth ()
int w0 = lines->size () > 0 ? lines->getLastRef()->maxLineWidth : 0;
DBG_OBJ_MSGF ("resize", 1, "w0 = %d", w0);
int wThis = min(w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth);
int wThis = std::min(w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth);
DBG_OBJ_MSGF ("resize", 1, "wThis = min(%d + %d + %d, %d) = %d",
w0, leftInnerPadding, boxDiffWidth (), lineBreakWidth,
wThis);
int w = max(wThis, wChild);
int w = std::max(wThis, wChild);
DBG_OBJ_LEAVE_VAL ("max(%d, %d) = %d", wThis, wChild, w);
return w;
}

View File

@ -1,8 +1,12 @@
static_assert( __cplusplus >= 2020'02 );
#ifndef __DW_TEXTBLOCK_HH__
#define __DW_TEXTBLOCK_HH__
#include <limits.h>
#include <algorithm>
#include "regardingborder.hh"
#include "../lout/misc.hh"
@ -401,8 +405,8 @@ protected:
inline int totalHeight (int marginNextLine)
{ return borderAscent + borderDescent
// Collapsing of the margins of adjacent lines is done here:
+ lout::misc::max (marginDescent - borderDescent, marginNextLine,
breakSpace); }
+ std::max( marginDescent - borderDescent, std::max( marginNextLine,
breakSpace ) ); }
/* Maximum of all line widths, including this line. Does not
* include the last space, but the last hyphen width. Please

View File

@ -217,7 +217,7 @@ void Textblock::TextblockIterator::getAllocation (int start, int end,
bool regardBorder =
textblock->mustBorderBeRegarded (textblock->lines->size ());
textOffset =
misc::max (regardBorder ? textblock->newLineLeftBorder : 0,
std::max (regardBorder ? textblock->newLineLeftBorder : 0,
textblock->boxOffsetX () + textblock->leftInnerPadding
+ (textblock->lines->size () == 0 ?
textblock->line1OffsetEff : 0));
@ -231,7 +231,7 @@ void Textblock::TextblockIterator::getAllocation (int start, int end,
w->content.type == core::Content::WIDGET_IN_FLOW ?
w->size.ascent - w->content.widget->getStyle()->margin.top :
w->size.ascent;
lineBorderAscent = misc::max (lineBorderAscent, borderAscent);
lineBorderAscent = std::max (lineBorderAscent, borderAscent);
}
}
@ -255,7 +255,7 @@ void Textblock::TextblockIterator::getAllocation (int start, int end,
int wordEnd = strlen(word->content.text);
if (start > 0 || end < wordEnd) {
end = misc::min(end, wordEnd); /* end could be INT_MAX */
end = std::min(end, wordEnd); /* end could be INT_MAX */
allocation->width =
textblock->textWidth (word->content.text, start, end - start,
word->style,

View File

@ -366,10 +366,10 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
line->breakSpace = 0;
bool regardBorder = mustBorderBeRegarded (line);
line->leftOffset = max (regardBorder ? newLineLeftBorder : 0,
line->leftOffset = std::max (regardBorder ? newLineLeftBorder : 0,
boxOffsetX () + leftInnerPadding
+ (lineIndex == 0 ? line1OffsetEff : 0));
line->rightOffset = max (regardBorder ? newLineRightBorder : 0,
line->rightOffset = std::max (regardBorder ? newLineRightBorder : 0,
boxRestWidth ());
DBG_OBJ_MSGF ("construct.line", 1,
@ -408,7 +408,7 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
line->lastOofRefPositionedBeforeThisLine = -1;
} else {
Line *prevLine = lines->getRef (lines->size () - 2);
line->maxLineWidth = max (lineWidth, prevLine->maxLineWidth);
line->maxLineWidth = std::max (lineWidth, prevLine->maxLineWidth);
line->lastOofRefPositionedBeforeThisLine =
prevLine->lastOofRefPositionedBeforeThisLine;
}
@ -435,8 +435,8 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
// zero height, which may cause endless loops. For this reasons,
// the height should be positive (assuming the caller passed
// minHeight > 0).
line->borderAscent = max (line->borderAscent, minHeight);
line->marginAscent = max (line->marginAscent, minHeight);
line->borderAscent = std::max (line->borderAscent, minHeight);
line->marginAscent = std::max (line->marginAscent, minHeight);
DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "borderAscent",
line->borderAscent);
@ -485,7 +485,7 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord,
}
line->lastOofRefPositionedBeforeThisLine =
max (line->lastOofRefPositionedBeforeThisLine, newLastOofPos);
std::max (line->lastOofRefPositionedBeforeThisLine, newLastOofPos);
DBG_OBJ_SET_NUM ("lastLine.lastOofRefPositionedBeforeThisLine",
line->lastOofRefPositionedBeforeThisLine);
@ -730,7 +730,7 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
"breakPos = %d, height = %d, lastFloatPos = %d",
breakPos, height, lastFloatPos);
int startSearch = max (firstIndex, lastFloatPos + 1);
int startSearch = std::max (firstIndex, lastFloatPos + 1);
int newFloatPos = -1;
// Step 1: search for the next float.
@ -795,13 +795,13 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
// Empty line. Too avoid too many lines one pixel high, we
// use the float heights.
if (newLineHasFloatLeft && newLineHasFloatRight)
minHeight = max (min (newLineLeftFloatHeight,
minHeight = std::max (std::min (newLineLeftFloatHeight,
newLineRightFloatHeight),
1);
else if (newLineHasFloatLeft && !newLineHasFloatRight)
minHeight = max (newLineLeftFloatHeight, 1);
minHeight = std::max (newLineLeftFloatHeight, 1);
else if (!newLineHasFloatLeft && newLineHasFloatRight)
minHeight = max (newLineRightFloatHeight, 1);
minHeight = std::max (newLineRightFloatHeight, 1);
else
// May this happen?
minHeight = 1;
@ -1238,11 +1238,11 @@ int Textblock::calcLinePartHeight (int firstWord, int lastWord)
for (int i = firstWord; i <= lastWord; i++) {
Word *word = words->getRef (i);
ascent = max (ascent, word->size.ascent);
descent = max (descent, word->size.descent);
ascent = std::max (ascent, word->size.ascent);
descent = std::max (descent, word->size.descent);
}
return max (ascent + descent, 1);
return std::max (ascent + descent, 1);
}
/**
@ -1331,11 +1331,11 @@ void Textblock::handleWordExtremes (int wordIndex)
wordExtremes.minWidthIntrinsic + word->hyphenWidth + corrDiffMin;
lastPar->parAdjustmentWidth +=
wordExtremes.adjustmentWidth + word->hyphenWidth + corrDiffMin;
lastPar->maxParMin = max (lastPar->maxParMin, lastPar->parMin);
lastPar->maxParMin = std::max (lastPar->maxParMin, lastPar->parMin);
lastPar->maxParMinIntrinsic =
max (lastPar->maxParMinIntrinsic, lastPar->parMinIntrinsic);
std::max (lastPar->maxParMinIntrinsic, lastPar->parMinIntrinsic);
lastPar->maxParAdjustmentWidth =
max (lastPar->maxParAdjustmentWidth, lastPar->parAdjustmentWidth);
std::max (lastPar->maxParAdjustmentWidth, lastPar->parAdjustmentWidth);
DBG_OBJ_ARRATTRSET_NUM ("paragraphs", paragraphs->size() - 1, "parMin",
lastPar->parMin);
@ -1369,9 +1369,9 @@ void Textblock::handleWordExtremes (int wordIndex)
lastPar->parMax += wordExtremes.maxWidth + word->hyphenWidth + corrDiffMax;
lastPar->parMaxIntrinsic +=
wordExtremes.maxWidthIntrinsic + word->hyphenWidth + corrDiffMax;
lastPar->maxParMax = max (lastPar->maxParMax, lastPar->parMax);
lastPar->maxParMax = std::max (lastPar->maxParMax, lastPar->parMax);
lastPar->maxParMaxIntrinsic =
max (lastPar->maxParMaxIntrinsic, lastPar->parMaxIntrinsic);
std::max (lastPar->maxParMaxIntrinsic, lastPar->parMaxIntrinsic);
DBG_OBJ_ARRATTRSET_NUM ("paragraphs", paragraphs->size() - 1, "parMax",
lastPar->parMax);
@ -1571,12 +1571,12 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex)
int len = word->style->font->ascent;
if (word->style->valign == core::style::VALIGN_SUPER)
len += len / 2;
line->contentAscent = max (line->contentAscent, len);
line->contentAscent = std::max (line->contentAscent, len);
len = word->style->font->descent;
if (word->style->valign == core::style::VALIGN_SUB)
len += word->style->font->ascent / 3;
line->contentDescent = max (line->contentDescent, len);
line->contentDescent = std::max (line->contentDescent, len);
int borderAscent, borderDescent, marginAscent, marginDescent;
@ -1600,7 +1600,7 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex)
borderDescent = marginDescent = word->size.descent;
if (word->content.type == core::Content::BREAK)
line->breakSpace = max (word->content.breakSpace, line->breakSpace);
line->breakSpace = std::max (word->content.breakSpace, line->breakSpace);
else if (word->content.type == core::Content::WIDGET_OOF_REF) {
word->content.widgetReference->parentRef =
makeParentRefInFlow (lineIndex);
@ -1613,10 +1613,10 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex)
"marginDescent = %d",
borderAscent, borderDescent, marginAscent, marginDescent);
line->borderAscent = max (line->borderAscent, borderAscent);
line->borderDescent = max (line->borderDescent, borderDescent);
line->marginAscent = max (line->marginAscent, marginAscent);
line->marginDescent = max (line->marginDescent, marginDescent);
line->borderAscent = std::max (line->borderAscent, borderAscent);
line->borderDescent = std::max (line->borderDescent, borderDescent);
line->marginAscent = std::max (line->marginAscent, marginAscent);
line->marginDescent = std::max (line->marginDescent, marginDescent);
DBG_OBJ_LEAVE ();
}
@ -1670,8 +1670,8 @@ void Textblock::accumulateWordData (int wordIndex)
word->totalWidth = prevWord->totalWidth
+ prevWord->origSpace - prevWord->hyphenWidth
+ word->size.width + word->hyphenWidth;
word->maxAscent = max (prevWord->maxAscent, word->size.ascent);
word->maxDescent = max (prevWord->maxDescent, word->size.descent);
word->maxAscent = std::max (prevWord->maxAscent, word->size.ascent);
word->maxDescent = std::max (prevWord->maxDescent, word->size.descent);
word->totalSpaceStretchability =
prevWord->totalSpaceStretchability + getSpaceStretchability(prevWord);
word->totalSpaceShrinkability =
@ -1735,8 +1735,8 @@ int Textblock::calcLineBreakWidth (int lineIndex)
} else
leftBorder = rightBorder = 0;
leftBorder = max (leftBorder, boxOffsetX());
rightBorder = max (rightBorder, boxRestWidth());
leftBorder = std::max (leftBorder, boxOffsetX());
rightBorder = std::max (rightBorder, boxRestWidth());
lineBreakWidth -= (leftBorder + rightBorder);
@ -1917,7 +1917,7 @@ void Textblock::rewrap ()
// the line list up from this position is rebuild.
lines->setSize (wrapRefLines);
DBG_OBJ_SET_NUM ("lines.size", lines->size ());
nonTemporaryLines = min (nonTemporaryLines, wrapRefLines);
nonTemporaryLines = std::min (nonTemporaryLines, wrapRefLines);
initNewLine ();
@ -1930,7 +1930,7 @@ void Textblock::rewrap ()
DBG_OBJ_MSGF ("construct.line", 0, "starting with word %d", firstWord);
lastWordDrawn = min (lastWordDrawn, firstWord - 1);
lastWordDrawn = std::min (lastWordDrawn, firstWord - 1);
DBG_OBJ_SET_NUM ("lastWordDrawn", lastWordDrawn);
for (int i = firstWord; i < words->size (); i++) {
@ -1993,7 +1993,7 @@ void Textblock::fillParagraphs ()
if (lines->size () > 0 && wrapRefParagraphs > 0) {
// Sometimes, wrapRefParagraphs is larger than lines->size(), due to
// floats? (Has to be clarified.)
int lineNo = min (wrapRefParagraphs, lines->size ()) - 1;
int lineNo = std::min (wrapRefParagraphs, lines->size ()) - 1;
firstWordOfLine = lines->getRef(lineNo)->lastWord + 1;
} else
firstWordOfLine = 0;
@ -2011,7 +2011,7 @@ void Textblock::fillParagraphs ()
else
// If there are no paragraphs yet, findParagraphOfWord will return
// -1: use 0 then instead.
parNo = max (0, findParagraphOfWord (firstWordOfLine));
parNo = std::max (0, findParagraphOfWord (firstWordOfLine));
paragraphs->setSize (parNo);
DBG_OBJ_SET_NUM ("paragraphs.size", paragraphs->size ());
@ -2070,7 +2070,7 @@ void Textblock::calcBorders (int lastOofRef, int height)
if (oofmDefined) {
int firstWordOfLine =
lines->size() > 0 ? lines->getLastRef()->lastWord + 1 : 0;
int effOofRef = max (lastOofRef, firstWordOfLine - 1);
int effOofRef = std::max (lastOofRef, firstWordOfLine - 1);
int yRel = yOffsetOfLineToBeCreated (), yRef;
for (int i = 0; i < NUM_OOFM; i++) {
@ -2122,21 +2122,21 @@ void Textblock::calcBorders (int lastOofRef, int height)
// meaningful values.)
if (thisHasLeft) {
newLineLeftBorder =
max (newLineLeftBorder,
std::max (newLineLeftBorder,
oofm->getLeftBorder (y, height, this, effOofRef)
- getGeneratorX (i));
newLineLeftFloatHeight =
max (newLineLeftFloatHeight,
std::max (newLineLeftFloatHeight,
oofm->getLeftFloatHeight (y, height, this, effOofRef));
}
if (thisHasRight) {
newLineRightBorder =
max (newLineRightBorder,
std::max (newLineRightBorder,
oofm->getRightBorder (y, height, this, effOofRef)
- getGeneratorRest (i));
newLineRightFloatHeight =
max (newLineRightFloatHeight,
std::max (newLineRightFloatHeight,
oofm->getRightFloatHeight (y, height, this, effOofRef));
}

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;

View File

@ -59,7 +59,7 @@ void Embed::getExtremesSimpl (Extremes *extremes)
resource->getExtremes (extremes);
correctExtremes (extremes, false);
extremes->adjustmentWidth =
misc::min (extremes->minWidthIntrinsic, extremes->minWidth);
std::min (extremes->minWidthIntrinsic, extremes->minWidth);
}
void Embed::sizeAllocateImpl (Allocation *allocation)
@ -408,7 +408,7 @@ int ComplexButtonResource::getAvailWidthOfChild (Widget *child, bool forceValue)
if (embedWidth == -1)
return -1;
else
return misc::max (embedWidth - 2 * reliefXThickness (), 0);
return std::max (embedWidth - 2 * reliefXThickness (), 0);
}
int ComplexButtonResource::getAvailHeightOfChild (Widget *child,
@ -418,7 +418,7 @@ int ComplexButtonResource::getAvailHeightOfChild (Widget *child,
if (embedHeight == -1)
return -1;
else
return misc::max (embedHeight - 2 * reliefYThickness (), 0);
return std::max (embedHeight - 2 * reliefYThickness (), 0);
}
void ComplexButtonResource::correctRequisitionOfChild (Widget *child,
@ -435,14 +435,14 @@ void ComplexButtonResource::correctRequisitionOfChild (Widget *child,
/* FIXME: Typo for getAvailWidth()? */
int availWidth = getEmbed()->getAvailHeight (false);
if (availWidth != -1) {
int baseWidth = misc::max (availWidth
int baseWidth = std::max (availWidth
- getEmbed()->boxDiffWidth ()
- 2 * reliefXThickness (),
0);
int newWidth =
child->applyPerWidth (baseWidth, child->getStyle()->width);
requisition->width = allowDecreaseWidth ?
newWidth : misc::max (requisition->width, newWidth);
newWidth : std::max (requisition->width, newWidth);
}
} else
getEmbed()->correctReqWidthOfChildNoRec (child, requisition,
@ -464,7 +464,7 @@ void ComplexButtonResource::correctExtremesOfChild (Widget *child,
if (style::isPerLength (child->getStyle()->width)) {
int availWidth = getEmbed()->getAvailHeight (false);
if (availWidth != -1) {
int baseWidth = misc::max (availWidth
int baseWidth = std::max (availWidth
- getEmbed()->boxDiffWidth ()
- 2 * reliefXThickness (),
0);

View File

@ -941,19 +941,19 @@ int Widget::calcWidth (style::Length cssValue, int refWidth, Widget *refWidget,
if (style::isAbsLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "absolute width: %dpx",
style::absLengthVal (cssValue));
width = misc::max (style::absLengthVal (cssValue) + boxDiffWidth (),
width = std::max (style::absLengthVal (cssValue) + boxDiffWidth (),
limitMinWidth);
} else if (style::isPerLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "percentage width: %g%%",
100 * style::perLengthVal_useThisOnlyForDebugging
(cssValue));
if (refWidth != -1)
width = misc::max (applyPerWidth (refWidth, cssValue), limitMinWidth);
width = std::max (applyPerWidth (refWidth, cssValue), limitMinWidth);
else {
int availWidth = refWidget->getAvailWidth (forceValue);
if (availWidth != -1) {
int containerWidth = availWidth - refWidget->boxDiffWidth ();
width = misc::max (applyPerWidth (containerWidth, cssValue),
width = std::max (applyPerWidth (containerWidth, cssValue),
limitMinWidth);
} else
width = -1;
@ -1051,20 +1051,20 @@ int Widget::calcHeight (style::Length cssValue, bool usePercentage,
DBG_OBJ_MSGF ("resize", 1, "absolute height: %dpx",
style::absLengthVal (cssValue));
height =
misc::max (style::absLengthVal (cssValue) + boxDiffHeight (), 0);
std::max (style::absLengthVal (cssValue) + boxDiffHeight (), 0);
} else if (style::isPerLength (cssValue)) {
DBG_OBJ_MSGF ("resize", 1, "percentage height: %g%%",
100 *
style::perLengthVal_useThisOnlyForDebugging (cssValue));
if (usePercentage) {
if (refHeight != -1)
height = misc::max (applyPerHeight (refHeight, cssValue), 0);
height = std::max (applyPerHeight (refHeight, cssValue), 0);
else {
int availHeight = refWidget->getAvailHeight (forceValue);
if (availHeight != -1) {
int containerHeight = availHeight - refWidget->boxDiffHeight ();
height =
misc::max (applyPerHeight (containerHeight, cssValue), 0);
std::max (applyPerHeight (containerHeight, cssValue), 0);
} else
height = -1;
}
@ -1791,7 +1791,7 @@ int Widget::getAvailWidthOfChild (Widget *child, bool forceValue)
/* We only compute when forceValue is true */
if (forceValue) {
width = misc::max (getAvailWidth (true) - boxDiffWidth (), 0);
width = std::max (getAvailWidth (true) - boxDiffWidth (), 0);
if (width != -1) {
/* Clamp to min-width and max-width if given */
@ -1847,7 +1847,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
if (child->getStyle()->height == style::LENGTH_AUTO) {
DBG_OBJ_MSG ("resize", 1, "no specification");
if (forceValue)
height = misc::max (getAvailHeight (true) - boxDiffHeight (), 0);
height = std::max (getAvailHeight (true) - boxDiffHeight (), 0);
else
height = -1;
} else {
@ -1859,7 +1859,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
if (style::isAbsLength (child->getStyle()->height)) {
DBG_OBJ_MSGF ("resize", 1, "absolute height: %dpx",
style::absLengthVal (child->getStyle()->height));
height = misc::max (style::absLengthVal (child->getStyle()->height)
height = std::max (style::absLengthVal (child->getStyle()->height)
+ child->boxDiffHeight (), 0);
} else {
assert (style::isPerLength (child->getStyle()->height));
@ -1872,7 +1872,7 @@ int Widget::getAvailHeightOfChild (Widget *child, bool forceValue)
height = -1;
else
height =
misc::max (child->applyPerHeight (availHeight -
std::max (child->applyPerHeight (availHeight -
boxDiffHeight (),
child->getStyle()->height),
0);