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

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