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

@ -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;
}