Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

use std::min and std::max (#318)

Shinya Kitaoka12c444ee0dd7
diff --git a/toonz/sources/CMakeLists.txt b/toonz/sources/CMakeLists.txt
index 37448fda4..3d915de65 100644
--- a/toonz/sources/CMakeLists.txt
+++ b/toonz/sources/CMakeLists.txt
@@ -40,6 +40,7 @@ elseif(APPLE)
message("CMAKE_PREFIX_PATH:" ${CMAKE_PREFIX_PATH})
add_definitions(-DMACOSX -Di386)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++11 -stdlib=libc++ -fno-implicit-templates")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
elseif(PLATFORM EQUAL 32)
set(QT_PATH "~/Qt/5.6/clang_32/lib" CACHE PATH "Qt instlattion directory")
set(QT_LIB_PATH "${QT_PATH}/")
diff --git a/toonz/sources/colorfx/colorfxutils.cpp b/toonz/sources/colorfx/colorfxutils.cpp
index df755278b..ee6a545eb 100644
--- a/toonz/sources/colorfx/colorfxutils.cpp
+++ b/toonz/sources/colorfx/colorfxutils.cpp
@@ -82,10 +82,10 @@ void RubberDeform::getBBox(TRectD &bbox)
bbox.x0 = bbox.x1 = m_polyLoc[0].x;
bbox.y0 = bbox.y1 = m_polyLoc[0].y;
for (int i = 1; i < (int)m_polyLoc.size(); i++) {
- bbox.x0 = tmin(bbox.x0, m_polyLoc[i].x);
- bbox.x1 = tmax(bbox.x1, m_polyLoc[i].x);
- bbox.y0 = tmin(bbox.y0, m_polyLoc[i].y);
- bbox.y1 = tmax(bbox.y1, m_polyLoc[i].y);
+ bbox.x0 = std::min(bbox.x0, m_polyLoc[i].x);
+ bbox.x1 = std::max(bbox.x1, m_polyLoc[i].x);
+ bbox.y0 = std::min(bbox.y0, m_polyLoc[i].y);
+ bbox.y1 = std::max(bbox.y1, m_polyLoc[i].y);
}
}
@@ -268,103 +268,6 @@ int SFlashUtils::nbDiffVerts(const std::vector<TPointD> &pv) const
return lpv.size();
}
-/*
- TPointD p[3];
- TPixel32 col[2];
-// TPixel32 lc1,lc2;
- if ( pv[0]==pv[1] ) {
- p[0]=pv[0];
- p[1]=pv[2];
- p[2]=pv[3];
- col[0]=c1;
- col[1]=c2;
- } else if ( pv[0]==pv[2] ) {
- p[0]=pv[3];
- p[1]=pv[0];
- p[2]=pv[1];
- col[0]=c2;
- col[1]=c1;
- } else if ( pv[0]==pv[3] ) {
- p[0]=pv[2];
- p[1]=pv[0];
- p[2]=pv[1];
- col[0]=c2;
- col[1]=c1;
- } else if ( pv[1]==pv[2] ) {
- p[0]=pv[3];
- p[1]=pv[0];
- p[2]=pv[1];
- col[0]=c2;
- col[1]=c1;
- } else if ( pv[1]==pv[3] ) {
- p[0]=pv[2];
- p[1]=pv[0];
- p[2]=pv[1];
- col[0]=c2;
- col[1]=c1;
- } else if ( pv[2]==pv[3] ) {
- p[0]=pv[2];
- p[1]=pv[0];
- p[2]=pv[1];
- col[0]=c2;
- col[1]=c1;
- }
-
-
- TPointD pt1[4]={pv[0],pv[1],pv[2],pv[3]};
- TPointD pt2[3]={p[0],p[1],p[2]};
-
- TPointD uu=p[0]-p[1];
- TPointD up=(p[0]+p[1])*0.5;
- uu=normalize(uu);
- uu=rotate90(uu);
- TPointD up1=up+uu;
- TPointD up2=up-uu;
- double d1=tdistance(up1,p[2]);
- double d2=tdistance(up2,p[2]);
-
- std::vector<TPointD> lpv;
- if ( d1>d2 ) {
- lpv=pv;
- } else {
- TPointD sw=p[1];
- p[1]=p[2];
- p[2]=sw;
- }
-
-
- double a=tdistance(p[1],p[2]);
- double b=tdistance(p[2],p[0]);
- double c=tdistance(p[0],p[1]);
- double x=(b*b-c*c-a*a)/(-2.0*a);
- double m=sqrt(c*c-x*x);
- TPointD u=p[2]-p[1];
- u=normalize(u);
- TPointD q(p[1]+u*x);
-
- const double flashGrad=16384.0; // size of gradient square
- flash.setGradientFill(true,col[0],col[1]);
-// TPointD center=pv[0]*0.75+((p[1]+p[2])*0.5)*0.25;
- TPointD center=pv[0];
- TPointD e(p[2]-p[1]);
-
- double angle=rad2degree(atan(e));
- angle= angle<=0 ? 270+angle : angle-90;
- TRotation rM(angle);
- TTranslation tM(center.x,center.y);
- TScale sM(m/flashGrad,2*tmax(x,a-x)/flashGrad);
-
- flash.setFillStyleMatrix(tM*rM*sM);
- std::vector<TPointD> pp;
- pp.push_back(p[0]);
- pp.push_back(p[1]);
- pp.push_back(p[2]);
-
- flash.drawPolyline(pp);
-
-
-*/
-
void SFlashUtils::Triangle2Quad(std::vector<TPointD> &p) const
{
TPointD e;
diff --git a/toonz/sources/colorfx/regionstyles.cpp b/toonz/sources/colorfx/regionstyles.cpp
index fc33ff933..2a48b716f 100644
--- a/toonz/sources/colorfx/regionstyles.cpp
+++ b/toonz/sources/colorfx/regionstyles.cpp
@@ -1473,11 +1473,11 @@ int TPointShadowFillStyle::shadowOnEdge_parallel(TFlash &flash,
TPointD diff = normalize(rotate90(p1 - p0));
double len1 = diff * m_shadowDirection;
- len1 = tmax(0.0, len1);
+ len1 = std::max(0.0, len1);
diff = normalize(rotate90(p2 - p1));
double len2 = diff * m_shadowDirection;
- len2 = tmax(0.0, len2);
+ len2 = std::max(0.0, len2);
if ((len1 + len2) > 0) {
TPointD la = p1 + m_shadowDirection * len1 * m_shadowSize;
@@ -1786,7 +1786,7 @@ void TDottedFillStyle::setColorParamValue(int index, const TPixel32 &color)
void TDottedFillStyle::drawRegion(const TColorFunction *cf, const bool antiAliasing, TRegionOutline &boundary) const
{
- double LDotDist = tmax(m_dotDist, 0.1);
+ double LDotDist = std::max(m_dotDist, 0.1);
//double LDotSize=m_dotSize;
bool LIsShifted = m_isShifted;
const bool isTransparent = m_pointColor.m < 255;
@@ -1857,7 +1857,7 @@ int TDottedFillStyle::nbClip(const double LDotDist, const bool LIsShifted,
void TDottedFillStyle::drawRegion(TFlash &flash, const TRegion *r) const
{
- double LDotDist = tmax(m_dotDist, 0.1);
+ double LDotDist = std::max(m_dotDist, 0.1);
double LDotSize = m_dotSize;
bool LIsShifted = m_isShifted;
TRectD bbox(r->getBBox());
@@ -4036,8 +4036,8 @@ void TRadGradFillStyle::drawRegion(const TColorFunction *cf, const bool antiAlia
TRectD bbox(boundary.m_bbox);
double lx = bbox.x1 - bbox.x0;
double ly = bbox.y1 - bbox.y0;
- double r2 = (double)tmax(lx, ly) * 5.0;
- double r1 = 0.5 * (double)tmax(lx, ly) * m_Radius * 0.01;
+ double r2 = std::max(lx, ly) * 5.0;
+ double r1 = 0.5 * std::max(lx, ly) * m_Radius * 0.01;
double r0 = r1 * (100.0 - m_Smooth) * 0.01;
TPointD center((bbox.x1 + bbox.x0) / 2.0, (bbox.y1 + bbox.y0) / 2.0);
@@ -4087,7 +4087,7 @@ void TRadGradFillStyle::drawRegion(TFlash &flash, const TRegion *r) const
TRectD bbox(r->getBBox());
double lx = bbox.x1 - bbox.x0;
double ly = bbox.y1 - bbox.y0;
- double r1 = 0.5 * (double)tmax(lx, ly) * m_Radius * 0.01;
+ double r1 = 0.5 * std::max(lx, ly) * m_Radius * 0.01;
if (m_Smooth < 50)
r1 *= (0.3 * ((100 - m_Smooth) / 50.0) + 0.7);
TPointD center((bbox.x1 + bbox.x0) / 2.0, (bbox.y1 + bbox.y0) / 2.0);
@@ -4377,10 +4377,10 @@ void TCircleStripeFillStyle::drawRegion(const TColorFunction *cf, const bool ant
center.y = center.y + m_YPos * 0.01 * 0.5 * ly;
double maxDist = 0.0;
- maxDist = tmax(tdistance(center, TPointD(bbox.x0, bbox.y0)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x0, bbox.y1)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x1, bbox.y0)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x1, bbox.y1)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y0)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y1)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y0)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y1)), maxDist);
double halfThick = m_Thickness * 0.5;
for (double d = 0; d <= maxDist; d += m_Dist)
@@ -4407,10 +4407,10 @@ void TCircleStripeFillStyle::drawRegion(TFlash &flash, const TRegion *r) const
center.y = center.y + m_YPos * 0.01 * 0.5 * ly;
double maxDist = 0.0;
- maxDist = tmax(tdistance(center, TPointD(bbox.x0, bbox.y0)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x0, bbox.y1)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x1, bbox.y0)), maxDist);
- maxDist = tmax(tdistance(center, TPointD(bbox.x1, bbox.y1)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y0)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x0, bbox.y1)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y0)), maxDist);
+ maxDist = std::max(tdistance(center, TPointD(bbox.x1, bbox.y1)), maxDist);
int nbClip = 2;
double d = m_Dist;
diff --git a/toonz/sources/colorfx/strokestyles.cpp b/toonz/sources/colorfx/strokestyles.cpp
index f5c51e2a7..da5ef917b 100644
--- a/toonz/sources/colorfx/strokestyles.cpp
+++ b/toonz/sources/colorfx/strokestyles.cpp
@@ -2352,7 +2352,7 @@ void TSketchStrokeStyle::drawStroke(const TColorFunction *cf, const TStroke *str
int count = (int)(length * m_density);
- double maxDw = tmin(1.0, 20.0 / length);
+ double maxDw = std::min(1.0, 20.0 / length);
double minDw = 1.0 / length;
TPixel32 color;
@@ -2426,7 +2426,7 @@ void TSketchStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
int count = (int)(length * m_density);
- double maxDw = tmin(1.0, 20.0 / length);
+ double maxDw = std::min(1.0, 20.0 / length);
double minDw = 1.0 / length;
TPixel color(m_color.r, m_color.g, m_color.b, m_color.m);
flash.setLineColor(color);
@@ -2914,7 +2914,7 @@ void TBiColorStrokeStyle::drawStroke(const TColorFunction *cf, TStrokeOutline *o
void TBiColorStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
{
TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = tmax(10.0, m_parameter);
+ param.m_lengthStep = std::max(10.0, m_parameter);
TStrokeOutline outline;
TOutlineStyle::computeOutline(stroke, outline, param);
const std::vector<TOutlinePoint> &v = outline.getArray();
@@ -4094,7 +4094,7 @@ void TSawToothStrokeStyle::computeOutline(const TStroke *stroke,
void TSawToothStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const
{
TOutlineUtil::OutlineParameter param;
- param.m_lengthStep = tmax(20.0, m_parameter);
+ param.m_lengthStep = std::max(20.0, m_parameter);
TStrokeOutline outline;
TOutlineStyle::computeOutline(stroke, outline, param);
const std::vector<TOutlinePoint> &v = outline.getArray();
@@ -4708,10 +4708,10 @@ bool TZigzagStrokeStyle::getZigZagPosition(const TStroke *stroke, TRandom &rnd,
void TZigzagStrokeStyle::setRealMinMax() const
{
TZigzagStrokeStyle *ncpthis = const_cast<TZigzagStrokeStyle *>(this);
- double minDist = tmin(m_minDist, m_maxDist);
- double maxDist = tmax(m_minDist, m_maxDist);
- double minAngle = tmin(m_minAngle, m_maxAngle);
- double maxAngle = tmax(m_minAngle, m_maxAngle);
+ double minDist = std::min(m_minDist, m_maxDist);
+ double maxDist = std::max(m_minDist, m_maxDist);
+ double minAngle = std::min(m_minAngle, m_maxAngle);
+ double maxAngle = std::max(m_minAngle, m_maxAngle);
ncpthis->m_minDist = minDist;
ncpthis->m_maxDist = maxDist;
ncpthis->m_minAngle = minAngle;
@@ -6003,7 +6003,7 @@ void drawCenterline(const TStroke *stroke)
for (i = 0; i < n; ++i) {
const TThickQuadratic *chunk = stroke->getChunk(i);
double length = chunk->getLength(0, 1);
- int maxCount = tmax(tceil(length / (5 * sqrt(tglGetPixelSize2()))), 1);
+ int maxCount = std::max(tceil(length / (5 * sqrt(tglGetPixelSize2()))), 1);
double deltaT = 1.0 / maxCount;
double t = 0;
for (t = 0; t < 1 + (deltaT / 2); t += deltaT) {
diff --git a/toonz/sources/common/expressions/tgrammar.cpp b/toonz/sources/common/expressions/tgrammar.cpp
index 7bfec1ea2..9fbacff52 100644
--- a/toonz/sources/common/expressions/tgrammar.cpp
+++ b/toonz/sources/common/expressions/tgrammar.cpp
@@ -278,7 +278,7 @@ public:
}
};
- double delta = tmax(1.0, m_a->compute(vars));
+ double delta = std::max(1.0, m_a->compute(vars));
const TDoubleParam *ownerParam = getCalculator()->getOwnerParameter();
if (!ownerParam)
diff --git a/toonz/sources/common/tapptools/tcli.cpp b/toonz/sources/common/tapptools/tcli.cpp
index 73d7569ae..6f4e0dd37 100644
--- a/toonz/sources/common/tapptools/tcli.cpp
+++ b/toonz/sources/common/tapptools/tcli.cpp
@@ -568,8 +568,8 @@ void UsageImp::parse(int argc, char *argv[])
UsageLine &ul = **it;
int lmin, lmax;
getArgCountRange(ul, 0, ul.getCount() - 1, lmin, lmax);
- min = tmin(min, lmin);
- max = tmax(max, lmax);
+ min = std::min(min, lmin);
+ max = std::max(max, lmax);
if (matchArgCount(ul, 0, ul.getCount() - 1, argc - 1) == false)
it = usages.erase(it);
else
diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp
index b83d8fd8e..3f1b173fa 100644
--- a/toonz/sources/common/tapptools/tcolorutils.cpp
+++ b/toonz/sources/common/tapptools/tcolorutils.cpp
@@ -200,7 +200,7 @@ void chooseLeafToClusterize(ClusterContainer::iterator &itRet,
tmpMulteplicity = calcCovarianceEigenValues(clusterCovariance, eigenValues);
assert(tmpMulteplicity > 0);
- tmpEigenValue = tmax(eigenValues[0], eigenValues[1], eigenValues[2]);
+ tmpEigenValue = std::max({eigenValues[0], eigenValues[1], eigenValues[2]});
cluster->eigenValue = tmpEigenValue;
// eventuale aggiornamento del cluster da cercare
@@ -250,7 +250,7 @@ void chooseLeafToClusterize(ClusterContainer::iterator &itRet,
KEYER_FLOAT u23 = tmpMatrixM[1] * tmpMatrixM[2] - tmpMatrixM[5] * tmpMatrixM[0];
KEYER_FLOAT u33 = tmpMatrixM[0] * tmpMatrixM[4] - tmpMatrixM[1] * tmpMatrixM[1];
- KEYER_FLOAT uMax = tmax(tmax(u11, u12, u13), u22, u23, u33);
+ KEYER_FLOAT uMax = std::max({u11, u12, u13, u22, u23, u33});
if (uMax == u11) {
eigenVector[0] = u11;
@@ -284,8 +284,8 @@ void chooseLeafToClusterize(ClusterContainer::iterator &itRet,
short int row = -1;
short int col = -1;
- KEYER_FLOAT mMax = tmax(tmax(tmpMatrixM[0], tmpMatrixM[1], tmpMatrixM[2]),
- tmpMatrixM[4], tmpMatrixM[5], tmpMatrixM[8]);
+ KEYER_FLOAT mMax = std::max({tmpMatrixM[0], tmpMatrixM[1], tmpMatrixM[2],
+ tmpMatrixM[4], tmpMatrixM[5], tmpMatrixM[8]});
if (mMax == tmpMatrixM[0]) {
row = 1;
diff --git a/toonz/sources/common/tapptools/ttimer.cpp b/toonz/sources/common/tapptools/ttimer.cpp
index 6a63f3c17..974edc964 100644
--- a/toonz/sources/common/tapptools/ttimer.cpp
+++ b/toonz/sources/common/tapptools/ttimer.cpp
@@ -85,7 +85,7 @@ TTimer::Imp::Imp(std::string name, UINT timerRes, TTimer::Type type, TTimer *tim
throw TException("Unable to create timer");
}
- m_timerRes = tmin((int)tmax((int)tc.wPeriodMin, (int)m_timerRes), (int)tc.wPeriodMax);
+ m_timerRes = std::min((int)std::max((int)tc.wPeriodMin, (int)m_timerRes), (int)tc.wPeriodMax);
timeBeginPeriod(m_timerRes);
switch (type) {
diff --git a/toonz/sources/common/tcache/timagecache.cpp b/toonz/sources/common/tcache/timagecache.cpp
index f01c423a3..7871e0b0a 100644
--- a/toonz/sources/common/tcache/timagecache.cpp
+++ b/toonz/sources/common/tcache/timagecache.cpp
@@ -823,7 +823,7 @@ inline TINT32 hasExternalReferences(const TImageP &img)
}
#endif
- return tmax(refCount, img->getRefCount()) > 1;
+ return std::max(refCount, img->getRefCount()) > 1;
}
}
//------------------------------------------------------------------------------
diff --git a/toonz/sources/common/tcolor/tcolorvalue.cpp b/toonz/sources/common/tcolor/tcolorvalue.cpp
index 5f9101b0d..5d4f79448 100644
--- a/toonz/sources/common/tcolor/tcolorvalue.cpp
+++ b/toonz/sources/common/tcolor/tcolorvalue.cpp
@@ -17,8 +17,8 @@ void TColorValue::getHsv(int &ih, int &is, int &iv) const
assert(0 <= g && g <= 1);
assert(0 <= b && b <= 1);
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
v = max;
@@ -57,8 +57,8 @@ void TColorValue::getHls(double &h, double &l, double &s) const
double max, min;
double delta;
- max = tmax(m_r, m_g, m_b);
- min = tmin(m_r, m_g, m_b);
+ max = std::max({m_r, m_g, m_b});
+ min = std::min({m_r, m_g, m_b});
l = (max + min) / 2;
diff --git a/toonz/sources/common/tcolor/tpixelutils.cpp b/toonz/sources/common/tcolor/tpixelutils.cpp
index 512d800f9..4ab8e89ad 100644
--- a/toonz/sources/common/tcolor/tpixelutils.cpp
+++ b/toonz/sources/common/tcolor/tpixelutils.cpp
@@ -165,8 +165,8 @@ void RGB2HSV(double r, double g, double b,
double max, min;
double delta;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
*v = max;
@@ -201,8 +201,8 @@ void rgb2hsv(int dstHsv[3], const TPixel32 &srcRgb, int maxHsv)
g = srcRgb.g / 255.;
b = srcRgb.b / 255.;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
v = max;
@@ -283,8 +283,8 @@ void rgb2hls(double r, double g, double b,
double max, min;
double delta;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
*l = (max + min) / 2;
diff --git a/toonz/sources/common/tfx/tcacheresource.cpp b/toonz/sources/common/tfx/tcacheresource.cpp
index b5d0a1f06..5a1cc020b 100644
--- a/toonz/sources/common/tfx/tcacheresource.cpp
+++ b/toonz/sources/common/tfx/tcacheresource.cpp
@@ -765,7 +765,7 @@ void TCacheResource::releaseLock()
//DIAGNOSTICS_NUMBEREDSTR(prefix + QString::number((UINT) this) + " | Stack | ",
//"crStack", "releaseLock");
- m_locksCount = tmax(m_locksCount - 1, 0);
+ m_locksCount = std::max(m_locksCount - 1, 0);
if (m_locksCount > 0)
return;
diff --git a/toonz/sources/common/tfx/tpassivecachemanager.cpp b/toonz/sources/common/tfx/tpassivecachemanager.cpp
index 218e13711..9028bef2f 100644
--- a/toonz/sources/common/tfx/tpassivecachemanager.cpp
+++ b/toonz/sources/common/tfx/tpassivecachemanager.cpp
@@ -578,7 +578,7 @@ int TPassiveCacheManager::getNewPassiveCacheId()
int TPassiveCacheManager::updatePassiveCacheId(int id)
{
if (m_updatingPassiveCacheIds)
- m_currentPassiveCacheId = tmax(m_currentPassiveCacheId, id);
+ m_currentPassiveCacheId = std::max(m_currentPassiveCacheId, id);
else
id = getNewPassiveCacheId();
diff --git a/toonz/sources/common/tfx/ttzpimagefx.cpp b/toonz/sources/common/tfx/ttzpimagefx.cpp
index 29fff9ae3..4407d7e60 100644
--- a/toonz/sources/common/tfx/ttzpimagefx.cpp
+++ b/toonz/sources/common/tfx/ttzpimagefx.cpp
@@ -267,7 +267,7 @@ TRectD SandorFxRenderData::getBBoxEnlargement(const TRectD &bbox)
case ArtAtContour:
return bbox.enlarge(
- tmax(tceil(m_controllerBBox.getLx()), tceil(m_controllerBBox.getLy())) * m_contourParams.m_maxSize);
+ std::max(tceil(m_controllerBBox.getLx()), tceil(m_controllerBBox.getLy())) * m_contourParams.m_maxSize);
default:
assert(false);
diff --git a/toonz/sources/common/tgeometry/tcurves.cpp b/toonz/sources/common/tgeometry/tcurves.cpp
index a9ba86a3a..7a5c8e478 100644
--- a/toonz/sources/common/tgeometry/tcurves.cpp
+++ b/toonz/sources/common/tgeometry/tcurves.cpp
@@ -473,7 +473,7 @@ TRectD TThickQuadratic::getBBox() const
TRectD bBox = TQuadratic::getBBox();
- double maxRadius = tmax(m_thickP0, m_thickP1, m_thickP2);
+ double maxRadius = std::max({m_thickP0, m_thickP1, m_thickP2});
if (maxRadius > 0) {
// bBox.enlarge(maxRadius) si comporta male nel caso bBox.isEmpty()
bBox.x0 -= maxRadius;
diff --git a/toonz/sources/common/tgeometry/tcurveutil.cpp b/toonz/sources/common/tgeometry/tcurveutil.cpp
index 4cc6baf9d..7a1fcd793 100644
--- a/toonz/sources/common/tgeometry/tcurveutil.cpp
+++ b/toonz/sources/common/tgeometry/tcurveutil.cpp
@@ -315,14 +315,14 @@ int intersectCloseControlPoints(const TQuadratic &c0,
double dist2 = tdistance2(c0.getP1(), c0.getP2());
if (dist2 == 0)
dist2 = 1e-20;
- double val0 = tmax(dist1, dist2) / tmin(dist1, dist2);
+ double val0 = std::max(dist1, dist2) / std::min(dist1, dist2);
double dist3 = tdistance2(c1.getP0(), c1.getP1());
if (dist3 == 0)
dist3 = 1e-20;
double dist4 = tdistance2(c1.getP1(), c1.getP2());
if (dist4 == 0)
dist4 = 1e-20;
- double val1 = tmax(dist3, dist4) / tmin(dist3, dist4);
+ double val1 = std::max(dist3, dist4) / std::min(dist3, dist4);
if (val0 > 1000000 && val1 > 1000000) //entrambe c0 e c1 approssimate a segmenti
{
@@ -532,7 +532,7 @@ double computeStep(const TThickQuadratic &quad, double pixelSize)
q2(TPointD(cp0.y, cp0.thick), TPointD(cp1.y, cp1.thick), TPointD(cp2.y, cp2.thick)),
q3(TPointD(cp0.x, cp0.thick), TPointD(cp1.x, cp1.thick), TPointD(cp2.x, cp2.thick));
- return tmin(computeStep(q1, pixelSize), computeStep(q2, pixelSize), computeStep(q3, pixelSize));
+ return std::min({computeStep(q1, pixelSize), computeStep(q2, pixelSize), computeStep(q3, pixelSize)});
}
//=============================================================================
diff --git a/toonz/sources/common/tgeometry/tgeometry.cpp b/toonz/sources/common/tgeometry/tgeometry.cpp
index 932a31f3a..2cec8e19a 100644
--- a/toonz/sources/common/tgeometry/tgeometry.cpp
+++ b/toonz/sources/common/tgeometry/tgeometry.cpp
@@ -139,8 +139,9 @@ TRectD TAffine::operator*(const TRectD &rect) const
p2 = *this * rect.getP01(),
p3 = *this * rect.getP10(),
p4 = *this * rect.getP11();
- return TRectD(tmin(p1.x, p2.x, p3.x, p4.x), tmin(p1.y, p2.y, p3.y, p4.y),
- tmax(p1.x, p2.x, p3.x, p4.x), tmax(p1.y, p2.y, p3.y, p4.y));
+ return TRectD(
+ std::min({p1.x, p2.x, p3.x, p4.x}), std::min({p1.y, p2.y, p3.y, p4.y}),
+ std::max({p1.x, p2.x, p3.x, p4.x}), std::max({p1.y, p2.y, p3.y, p4.y}));
} else
return TConsts::infiniteRectD;
}
diff --git a/toonz/sources/common/timage_io/timage_io.cpp b/toonz/sources/common/timage_io/timage_io.cpp
index 8bb353e58..f729955e1 100644
--- a/toonz/sources/common/timage_io/timage_io.cpp
+++ b/toonz/sources/common/timage_io/timage_io.cpp
@@ -352,10 +352,10 @@ TImageP TImageReader::load0()
if (!m_region.isEmpty()) {
// Intersect with the externally specified loading region
- x0 = tmax(x0, m_region.x0);
- y0 = tmax(y0, m_region.y0);
- x1 = tmin(x1, m_region.x1);
- y1 = tmin(y1, m_region.y1);
+ x0 = std::max(x0, m_region.x0);
+ y0 = std::max(y0, m_region.y0);
+ x1 = std::min(x1, m_region.x1);
+ y1 = std::min(y1, m_region.y1);
if (x0 >= x1 || y0 >= y1)
return TImageP();
diff --git a/toonz/sources/common/tipc/t32bitsrv_wrap.cpp b/toonz/sources/common/tipc/t32bitsrv_wrap.cpp
index 1c83590d4..80da09252 100644
--- a/toonz/sources/common/tipc/t32bitsrv_wrap.cpp
+++ b/toonz/sources/common/tipc/t32bitsrv_wrap.cpp
@@ -34,12 +34,12 @@ int t32bitsrv::RasterExchanger<PIXEL>::read(const char *srcBuf, int len)
int xStart = (m_pix - m_ras->pixels(0)) % m_ras->getWrap();
int remainingData = len;
int lineData = m_ras->getLx() * sizeof(PIXEL);
- int lineDataToRead = tmin((int)((m_ras->getLx() - xStart) * sizeof(PIXEL)), remainingData);
+ int lineDataToRead = std::min((int)((m_ras->getLx() - xStart) * sizeof(PIXEL)), remainingData);
for (; remainingData > 0;
m_pix += (m_ras->getWrap() - xStart),
remainingData -= lineDataToRead,
- lineDataToRead = tmin(lineData, remainingData),
+ lineDataToRead = std::min(lineData, remainingData),
xStart = 0)
memcpy(m_pix, srcBuf, lineDataToRead);
}
@@ -62,12 +62,12 @@ int t32bitsrv::RasterExchanger<PIXEL>::write(char *dstBuf, int len)
int xStart = (m_pix - m_ras->pixels(0)) % m_ras->getWrap();
int remainingData = len;
int lineData = m_ras->getLx() * sizeof(PIXEL);
- int lineDataToWrite = tmin((int)((m_ras->getLx() - xStart) * sizeof(PIXEL)), remainingData);
+ int lineDataToWrite = std::min((int)((m_ras->getLx() - xStart) * sizeof(PIXEL)), remainingData);
for (; remainingData > 0;
m_pix += (m_ras->getWrap() - xStart),
remainingData -= lineDataToWrite,
- lineDataToWrite = tmin(lineData, remainingData),
+ lineDataToWrite = std::min(lineData, remainingData),
xStart = 0)
memcpy(dstBuf, m_pix, lineDataToWrite);
}
diff --git a/toonz/sources/common/tipc/tipc.cpp b/toonz/sources/common/tipc/tipc.cpp
index 2eb026485..4da83ccab 100644
--- a/toonz/sources/common/tipc/tipc.cpp
+++ b/toonz/sources/common/tipc/tipc.cpp
@@ -476,7 +476,7 @@ int tipc::shm_maxSegmentSize()
size_t valSize = sizeof(TINT64);
TINT64 val;
sysctlbyname("kern.sysv.shmmax", &val, &valSize, NULL, 0);
- shm_max = tmin(val, (TINT64)(std::numeric_limits<int>::max)());
+ shm_max = std::min(val, (TINT64)(std::numeric_limits<int>::max)());
#else
//Windows case: no such limit
//Observe that QSharedMemory accepts only an int size - so the num_lim is against int.
@@ -497,7 +497,7 @@ int tipc::shm_maxSegmentCount()
size_t valSize = sizeof(TINT64);
TINT64 val;
sysctlbyname("kern.sysv.shmseg", &val, &valSize, NULL, 0);
- shm_seg = tmin(val, (TINT64)(std::numeric_limits<int>::max)());
+ shm_seg = std::min(val, (TINT64)(std::numeric_limits<int>::max)());
#else
//Windows case: no such limit - again, using limit against max due to Qt
shm_seg = (std::numeric_limits<int>::max)();
@@ -516,7 +516,7 @@ int tipc::shm_maxSharedPages()
size_t valSize = sizeof(TINT64);
TINT64 val;
sysctlbyname("kern.sysv.shmall", &val, &valSize, NULL, 0);
- shm_all = tmin(val, (TINT64)(std::numeric_limits<int>::max)());
+ shm_all = std::min(val, (TINT64)(std::numeric_limits<int>::max)());
#else
shm_all = (std::numeric_limits<int>::max)();
#endif
@@ -534,7 +534,7 @@ int tipc::shm_maxSharedCount()
size_t valSize = sizeof(TINT64);
TINT64 val;
sysctlbyname("kern.sysv.shmmni", &val, &valSize, NULL, 0);
- shm_mni = tmin(val, (TINT64)(std::numeric_limits<int>::max)());
+ shm_mni = std::min(val, (TINT64)(std::numeric_limits<int>::max)());
#else
shm_mni = (std::numeric_limits<int>::max)();
#endif
@@ -605,7 +605,7 @@ int tipc::create(QSharedMemory &shmem, int size, bool strictSize)
bool ok, retried = false;
if (!strictSize)
- size = tmin(size, (int)shm_maxSegmentSize());
+ size = std::min(size, (int)shm_maxSegmentSize());
tipc_debug(qDebug() << "shMem create: size =" << size);
@@ -662,7 +662,7 @@ bool tipc::writeShMemBuffer(Stream &stream, Message &msg, int bufSize, ShMemWrit
//Write to the shared memory segment
tipc_debug(QTime xchTime; xchTime.start());
shmem.lock();
- remainingData -= chunkData = dataWriter->write((char *)shmem.data(), tmin(shmem.size(), remainingData));
+ remainingData -= chunkData = dataWriter->write((char *)shmem.data(), std::min(shmem.size(), remainingData));
shmem.unlock();
tipc_debug(qDebug() << "exchange time:" << xchTime.elapsed());
diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp
index 62b368de9..fbc14b539 100644
--- a/toonz/sources/common/tmeshimage/tmeshimage.cpp
+++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp
@@ -129,10 +129,10 @@ TRectD TTextureMesh::getBBox() const
for (v = 0; v != vCount; ++v) {
const TTextureVertex &vx = m_vertices[v];
- result.x0 = tmin(result.x0, vx.P().x);
- result.y0 = tmin(result.y0, vx.P().y);
- result.x1 = tmax(result.x1, vx.P().x);
- result.y1 = tmax(result.y1, vx.P().y);
+ result.x0 = std::min(result.x0, vx.P().x);
+ result.y0 = std::min(result.y0, vx.P().y);
+ result.x1 = std::max(result.x1, vx.P().x);
+ result.y1 = std::max(result.y1, vx.P().y);
}
return result;
@@ -279,7 +279,7 @@ void TTextureMesh::loadData(TIStream &is)
is.closeChild();
} else if (str == "rigidities") {
is >> size;
- size = tmin(size, this->verticesCount());
+ size = std::min(size, this->verticesCount());
for (i = 0; i < size; ++i)
is >> m_vertices[i].P().rigidity;
diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp
index e26ecd188..4e9686e73 100644
--- a/toonz/sources/common/tparam/tdoubleparam.cpp
+++ b/toonz/sources/common/tparam/tdoubleparam.cpp
@@ -229,8 +229,8 @@ inline double getEaseInOutValue(
return k0.m_value;
else if (x >= x3)
return k1.m_value;
- double e0 = tmax(k0.m_speedOut.x, 0.0);
- double e1 = tmax(-k1.m_speedIn.x, 0.0);
+ double e0 = std::max(k0.m_speedOut.x, 0.0);
+ double e1 = std::max(-k1.m_speedIn.x, 0.0);
if (percentage) {
e0 *= x3 * 0.01;
e1 *= x3 * 0.01;
@@ -661,7 +661,7 @@ double TDoubleParam::getValue(double frame, bool leftmost) const
tmpKeyframe[2] = *b;
b = tmpKeyframe.begin() + 2;
- int relPos = tfloor(b->m_frame - a->m_frame), step = tmin(a->m_step, relPos);
+ int relPos = tfloor(b->m_frame - a->m_frame), step = std::min(a->m_step, relPos);
tmpKeyframe[2].m_frame = a->m_frame + tfloor(relPos, step);
if (frame > b->m_frame)
diff --git a/toonz/sources/common/tparam/tparamset.cpp b/toonz/sources/common/tparam/tparamset.cpp
index b488040fa..88b6c2ca8 100644
--- a/toonz/sources/common/tparam/tparamset.cpp
+++ b/toonz/sources/common/tparam/tparamset.cpp
@@ -10,31 +10,6 @@
//---------------------------------------------------------
-/*
-class ChangeBlock {
-public:
- ChangeBlock()
- : m_firstAffectedFrame ( TParamChange::m_maxFrame)
- , m_lastAffectedFrame ( TParamChange::m_minFrame)
- {
- }
-
- ~ChangeBlock()
- {
- }
-
- void add(const TParamChange &change)
- {
- m_firstAffectedFrame = tmin(m_firstAffectedFrame, change.m_firstAffectedFrame);
- m_lastAffectedFrame = tmax(m_lastAffectedFrame , change.m_lastAffectedFrame);
-
- m_changes.push_back(change.clone());
- }
- vector<TParamChange*> m_changes;
-double m_firstAffectedFrame;
-double m_lastAffectedFrame;
-};
-*/
namespace
{
void doRelease(const std::pair<TParam *, std::string> &param)
@@ -74,28 +49,6 @@ public:
void onChange(const TParamChange &change)
{
-
- /*
- if (!m_changeBlock) // se non stiamo modificando un blocco di parametri, invio la notifica
- {
- vector<TParam*> params;
- params.push_back(change.m_param);
-
- TParamSetChange psChange(m_param, change.m_firstAffectedFrame, change.m_lastAffectedFrame,
- params, change.m_undoing);
- notify(psChange);
- }
- else
- notify(change);
-
- if (!m_changeBlock) // se non stiamo modificando un blocco di parametri, invio la notifica
- notify(change);
- else
- {
- //metto da parte la TParamChange, per poi alla fine notificare una TParamSetChange
- m_changeBlock->add(change);
- }
- */
}
};
diff --git a/toonz/sources/common/trasterimage/trasterimage.cpp b/toonz/sources/common/trasterimage/trasterimage.cpp
index ecfeb2481..b503aa9a9 100644
--- a/toonz/sources/common/trasterimage/trasterimage.cpp
+++ b/toonz/sources/common/trasterimage/trasterimage.cpp
@@ -84,7 +84,7 @@ void TRasterImage::makeIcon(const TRaster32P &dstRas)
dpiy = 1;
double sx = (double)dstRas->getLx() * dpix / (double)srcRas->getLx();
double sy = (double)dstRas->getLy() * dpiy / (double)srcRas->getLy();
- double sc = tmax(sx, sy);
+ double sc = std::max(sx, sy);
TAffine aff = TScale(sc / dpix, sc / dpiy)
.place(srcRas->getCenterD(), dstRas->getCenterD());
diff --git a/toonz/sources/common/trop/brush.cpp b/toonz/sources/common/trop/brush.cpp
index f716657c3..c142fc4d5 100644
--- a/toonz/sources/common/trop/brush.cpp
+++ b/toonz/sources/common/trop/brush.cpp
@@ -22,7 +22,7 @@ public:
int y = m_radius; // inizializzazione indice scanline
int x = 0; // inizializzazione indice colonna
do {
- m_array[y] = tmax(x, m_array[y]);
+ m_array[y] = std::max(x, m_array[y]);
m_array[x] = y;
if (dCircle <= 0) {
dCircle = dCircle + 2 * x + 3;
@@ -95,8 +95,8 @@ void TRop::brush(
// N.B. le coordinate sono relative ad un sist. di rif. con l'origine in a
// l'eq. della retta e' alpha * x + beta * y = 0
- int yMin = tmax(a.y, 0) - a.y; // clipping y + cambio riferimento
- int yMax = tmin(b.y, ly - 1) - a.y; // (trasporto dell'origine in a)
+ int yMin = std::max(a.y, 0) - a.y; // clipping y + cambio riferimento
+ int yMax = std::min(b.y, ly - 1) - a.y; // (trasporto dell'origine in a)
if (dx > 0 && m <= 1) {
// midpoint algorithm
TPoint segm;
@@ -122,12 +122,12 @@ void TRop::brush(
// NordEst
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x + segm.x - count, a.x, 0); // clipping x + ritorno alle
- xMax = tmin(a.x + segm.x, b.x, lx - 1); // coordinate "di schermo"
+ xMin = std::max({a.x + segm.x - count, a.x, 0}); // clipping x + ritorno alle
+ xMax = std::min({a.x + segm.x, b.x, lx - 1}); // coordinate "di schermo"
} else {
- xMin = tmax(a.x - segm.x, a.x - dx, 0); // clipping x + riflessione + ritorno
- xMax = tmin(a.x - segm.x + count, a.x, lx - 1); // alle coordinate "di schermo"
+ xMin = std::max({a.x - segm.x, a.x - dx, 0}); // clipping x + riflessione + ritorno
+ xMax = std::min({a.x - segm.x + count, a.x, lx - 1}); // alle coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segm.y + a.y) + xMin;
@@ -158,12 +158,12 @@ void TRop::brush(
while (segm.y <= yMax) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x + segm.x, 0); // clipping x + ritorno alle
- xMax = tmin(a.x + segm.x, lx - 1); // coordinate "di schermo"
+ xMin = std::max(a.x + segm.x, 0); // clipping x + ritorno alle
+ xMax = std::min(a.x + segm.x, lx - 1); // coordinate "di schermo"
} else {
- xMin = tmax(a.x - segm.x, 0); // clipping x + riflessione + ritorno
- xMax = tmin(a.x - segm.x, lx - 1); // alle coordinate "di schermo"
+ xMin = std::max(a.x - segm.x, 0); // clipping x + riflessione + ritorno
+ xMax = std::min(a.x - segm.x, lx - 1); // alle coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segm.y + a.y) + xMin;
@@ -193,12 +193,12 @@ void TRop::brush(
// ----- punti iniziali coincidenti: disegna un cerchio
if (a == b) {
- int yMin = tmax(a.y - radius, 0); // clipping y
- int yMax = tmin(a.y + radius, ly - 1); // clipping y
+ int yMin = std::max(a.y - radius, 0); // clipping y
+ int yMax = std::min(a.y + radius, ly - 1); // clipping y
for (y = yMin; y <= yMax; y++) {
int deltay = abs(y - a.y);
- int xMin = tmax(a.x - halfCord.getCord(deltay), 0); // clipping x
- int xMax = tmin(a.x + halfCord.getCord(deltay), lx - 1); // clipping x
+ int xMin = std::max(a.x - halfCord.getCord(deltay), 0); // clipping x
+ int xMax = std::min(a.x + halfCord.getCord(deltay), lx - 1); // clipping x
TPixel32 *p = ras->pixels(y) + xMin;
TPixel32 *q = p + (xMax - xMin);
while (p <= q)
@@ -210,14 +210,14 @@ void TRop::brush(
// ----- rettangolo orizzontale (a.y = b.y, a.x != b.x)
if (a.y == b.y) {
- int yMin = tmax((a.y - radius), 0); // clipping y
- int yMax = tmin((a.y + radius), ly - 1); // clipping y
- int xLeft = tmin(a.x, b.x);
- int xRight = tmax(a.x, b.x);
+ int yMin = std::max((a.y - radius), 0); // clipping y
+ int yMax = std::min((a.y + radius), ly - 1); // clipping y
+ int xLeft = std::min(a.x, b.x);
+ int xRight = std::max(a.x, b.x);
for (y = yMin; y <= yMax; y++) {
int deltay = abs(y - a.y);
- int xMin = tmax(xLeft - halfCord.getCord(deltay), 0); // clipping x
- int xMax = tmin(xRight + halfCord.getCord(deltay), lx - 1); // clipping x
+ int xMin = std::max(xLeft - halfCord.getCord(deltay), 0); // clipping x
+ int xMax = std::min(xRight + halfCord.getCord(deltay), lx - 1); // clipping x
TPixel32 *p = ras->pixels(y) + xMin;
TPixel32 *q = p + (xMax - xMin);
while (p <= q)
@@ -230,12 +230,12 @@ void TRop::brush(
// ----- rettangolo verticale (a.x = b.x, a.y != b.y)
if (a.x == b.x) {
- int xMin = tmax(a.x - radius, 0); // clipping x
- int xMax = tmin(a.x + radius, lx - 1); // clipping x
+ int xMin = std::max(a.x - radius, 0); // clipping x
+ int xMax = std::min(a.x + radius, lx - 1); // clipping x
for (x = xMin; x <= xMax; x++) {
int deltax = abs(x - a.x);
- int yMin = tmax(a.y - halfCord.getCord(deltax), 0); // clipping y
- int yMax = tmin(b.y + halfCord.getCord(deltax), ly - 1); // clipping y
+ int yMin = std::max(a.y - halfCord.getCord(deltax), 0); // clipping y
+ int yMax = std::min(b.y + halfCord.getCord(deltax), ly - 1); // clipping y
if (yMin <= yMax) {
TPixel32 *p = ras->pixels(yMin) + x;
TPixel32 *q = ras->pixels(yMax) + x;
@@ -319,24 +319,24 @@ void TRop::brush(
// ----- riempie "calotte" circolari
// ----- riempie "calotta" circolare inferiore
- int yMin = tmax(a.y - radius, 0); // clipping y
- int yMax = tmin(a.y - cutExt - 1, ly - 1); // clipping y
+ int yMin = std::max(a.y - radius, 0); // clipping y
+ int yMax = std::min(a.y - cutExt - 1, ly - 1); // clipping y
for (y = yMin; y <= yMax; y++) {
int r = halfCord.getCord(a.y - y);
- int xMin = tmax(a.x - r, 0); // clipping x
- int xMax = tmin(a.x + r, lx - 1); // clipping x
+ int xMin = std::max(a.x - r, 0); // clipping x
+ int xMax = std::min(a.x + r, lx - 1); // clipping x
TPixel32 *p = ras->pixels(y) + xMin;
TPixel32 *q = p + (xMax - xMin);
while (p <= q)
*p++ = col;
}
// ----- riempie "calotta" circolare superiore
- yMin = tmax(b.y + cutExt + 1, 0); // clipping y
- yMax = tmin(b.y + radius, ly - 1); // clipping y
+ yMin = std::max(b.y + cutExt + 1, 0); // clipping y
+ yMax = std::min(b.y + radius, ly - 1); // clipping y
for (y = yMin; y <= yMax; y++) {
int r = halfCord.getCord(y - b.y);
- int xMin = tmax(b.x - r, 0); // clipping x
- int xMax = tmin(b.x + r, lx - 1); // clipping x
+ int xMin = std::max(b.x - r, 0); // clipping x
+ int xMax = std::min(b.x + r, lx - 1); // clipping x
TPixel32 *p = ras->pixels(y) + xMin;
TPixel32 *q = p + (xMax - xMin);
while (p <= q)
@@ -358,8 +358,8 @@ void TRop::brush(
// N.B. le coordinate sono relative ad un sist. di rif. con l'origine sul centro
// del cerchio inferiore
- yMin = tmax(a.y - cutExt, 0) - a.y; // clipping y
- yMax = tmin(a.y + cutIn, b.y - cutIn - 1, ly - 1) - a.y; // clipping y
+ yMin = std::max(a.y - cutExt, 0) - a.y; // clipping y
+ yMax = std::min({a.y + cutIn, b.y - cutIn - 1, ly - 1}) - a.y; // clipping y
// l'eq. della retta e' alpha * x + beta * y + gammaRight = 0
const int alpha = dy, beta = -dx;
@@ -382,11 +382,11 @@ void TRop::brush(
{
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x - halfCord.getCord(abs(segmRight.y)), 0); // clipping x
- xMax = tmin(a.x + tmin(segmRight.x, xSegmMax), lx - 1); // clipping x
+ xMin = std::max(a.x - halfCord.getCord(abs(segmRight.y)), 0); // clipping x
+ xMax = std::min(a.x + std::min(segmRight.x, xSegmMax), lx - 1); // clipping x
} else {
- xMin = tmax(a.x - tmin(segmRight.x, xSegmMax), 0); // clipping x + ritorno alle
- xMax = tmin(a.x + halfCord.getCord(abs(segmRight.y)), lx - 1); // coordinate "di schermo"
+ xMin = std::max(a.x - std::min(segmRight.x, xSegmMax), 0); // clipping x + ritorno alle
+ xMax = std::min(a.x + halfCord.getCord(abs(segmRight.y)), lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segmRight.y + a.y) + xMin;
TPixel32 *q = p + (xMax - xMin);
@@ -406,11 +406,11 @@ void TRop::brush(
while (segmRight.y <= yMax) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x - halfCord.getCord(abs(segmRight.y)), 0); // clipping x
- xMax = tmin(a.x + segmRight.x, lx - 1); // clipping x
+ xMin = std::max(a.x - halfCord.getCord(abs(segmRight.y)), 0); // clipping x
+ xMax = std::min(a.x + segmRight.x, lx - 1); // clipping x
} else {
- xMin = tmax(a.x - segmRight.x, 0); // clipping x + ritorno alle coordinate
- xMax = tmin(a.x + halfCord.getCord(abs(segmRight.y)), lx - 1); // "di schermo"
+ xMin = std::max(a.x - segmRight.x, 0); // clipping x + ritorno alle coordinate
+ xMax = std::min(a.x + halfCord.getCord(abs(segmRight.y)), lx - 1); // "di schermo"
}
TPixel32 *p = ras->pixels(segmRight.y + a.y) + xMin;
TPixel32 *q = p + (xMax - xMin);
@@ -433,8 +433,8 @@ void TRop::brush(
// N.B. le coordinate sono relative ad un sist. di rif. con l'origine sul centro
// del cerchio superiore
- yMin = tmax(b.y - cutIn, a.y + cutIn + 1, 0) - b.y; // clipping y
- yMax = tmin(b.y + cutExt, ly - 1) - b.y; // clipping y
+ yMin = std::max({b.y - cutIn, a.y + cutIn + 1, 0}) - b.y; // clipping y
+ yMax = std::min(b.y + cutExt, ly - 1) - b.y; // clipping y
// l'eq. della retta e' alpha * x + beta * y + gammaLeft = 0
const double gammaLeft = leftDown.y * dx - leftDown.x * dy;
@@ -447,11 +447,11 @@ void TRop::brush(
while (segmLeft.y <= yMax) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(b.x + tmax(segmLeft.x, xSegmMin - dx), 0); // clipping x
- xMax = tmin(b.x + halfCord.getCord(abs(segmLeft.y)), lx - 1); // clipping x
+ xMin = std::max(b.x + std::max(segmLeft.x, xSegmMin - dx), 0); // clipping x
+ xMax = std::min(b.x + halfCord.getCord(abs(segmLeft.y)), lx - 1); // clipping x
} else {
- xMin = tmax(b.x - halfCord.getCord(abs(segmLeft.y)), 0); // clipping x + ritorno alle
- xMax = tmin(b.x - tmax(segmLeft.x, xSegmMin - dx), lx - 1); // coordinate "di schermo"
+ xMin = std::max(b.x - halfCord.getCord(abs(segmLeft.y)), 0); // clipping x + ritorno alle
+ xMax = std::min(b.x - std::max(segmLeft.x, xSegmMin - dx), lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segmLeft.y + b.y) + xMin;
TPixel32 *q = p + (xMax - xMin);
@@ -474,11 +474,11 @@ void TRop::brush(
while (segmLeft.y <= yMax) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(b.x + segmLeft.x, 0); // clipping x
- xMax = tmin(b.x + halfCord.getCord(abs(segmLeft.y)), lx - 1); // clipping x
+ xMin = std::max(b.x + segmLeft.x, 0); // clipping x
+ xMax = std::min(b.x + halfCord.getCord(abs(segmLeft.y)), lx - 1); // clipping x
} else {
- xMin = tmax(b.x - halfCord.getCord(abs(segmLeft.y)), 0); // clipping x + ritorno alle
- xMax = tmin(b.x - segmLeft.x, lx - 1); // coordinate "di schermo"
+ xMin = std::max(b.x - halfCord.getCord(abs(segmLeft.y)), 0); // clipping x + ritorno alle
+ xMax = std::min(b.x - segmLeft.x, lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segmLeft.y + b.y) + xMin;
TPixel32 *q = p + (xMax - xMin);
@@ -506,8 +506,8 @@ void TRop::brush(
// retta destra di equaz. alpha * x + beta * y + gammaRight = 0
// retta sinistra di equaz. alpha * x + beta * y + gammaLeft = 0
- yMin = tmax(a.y + cutIn + 1, 0) - a.y; //clipping y
- yMax = tmin(b.y - cutIn - 1, ly - 1) - a.y; //clipping y
+ yMin = std::max(a.y + cutIn + 1, 0) - a.y; //clipping y
+ yMax = std::min(b.y - cutIn - 1, ly - 1) - a.y; //clipping y
if (m <= 1) {
// midpoint algorithm; le scanline vengono disegnate solo
// sul NordEst. L'ultima scanline non viene disegnata
@@ -524,11 +524,11 @@ void TRop::brush(
{
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x + tmax(segmLeft.x, xSegmMin), 0); // clipping x
- xMax = tmin(a.x + tmin(segmRight.x, xSegmMax), lx - 1); // clipping x
+ xMin = std::max(a.x + std::max(segmLeft.x, xSegmMin), 0); // clipping x
+ xMax = std::min(a.x + std::min(segmRight.x, xSegmMax), lx - 1); // clipping x
} else {
- xMin = tmax(a.x - tmin(segmRight.x, xSegmMax), 0); // clipping x + ritorno alle
- xMax = tmin(a.x - tmax(segmLeft.x, xSegmMin), lx - 1); // coordinate "di schermo"
+ xMin = std::max(a.x - std::min(segmRight.x, xSegmMax), 0); // clipping x + ritorno alle
+ xMax = std::min(a.x - std::max(segmLeft.x, xSegmMin), lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segmRight.y + a.y) + xMin;
@@ -562,11 +562,11 @@ void TRop::brush(
while (segmRight.y <= yMax) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x + segmLeft.x, 0); // clipping x
- xMax = tmin(a.x + segmRight.x, lx - 1); // clipping x
+ xMin = std::max(a.x + segmLeft.x, 0); // clipping x
+ xMax = std::min(a.x + segmRight.x, lx - 1); // clipping x
} else {
- xMin = tmax(a.x - segmRight.x, 0); // clipping x + ritorno alle
- xMax = tmin(a.x - segmLeft.x, lx - 1); // coordinate "di schermo"
+ xMin = std::max(a.x - segmRight.x, 0); // clipping x + ritorno alle
+ xMax = std::min(a.x - segmLeft.x, lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(segmRight.y + a.y) + xMin;
@@ -600,16 +600,16 @@ void TRop::brush(
// N.B. coordinate di schermo (riflessione per k<0 )
- yMin = tmax(b.y - cutIn, 0);
- yMax = tmin(a.y + cutIn, ly - 1);
+ yMin = std::max(b.y - cutIn, 0);
+ yMax = std::min(a.y + cutIn, ly - 1);
for (y = yMin; y <= yMax; y++) {
int xMin, xMax;
if (k > 0) {
- xMin = tmax(a.x - halfCord.getCord(abs(y - a.y)), 0); // clipping x
- xMax = tmin(b.x + halfCord.getCord(abs(b.y - y)), lx - 1); // clipping x
+ xMin = std::max(a.x - halfCord.getCord(abs(y - a.y)), 0); // clipping x
+ xMax = std::min(b.x + halfCord.getCord(abs(b.y - y)), lx - 1); // clipping x
} else {
- xMin = tmax(b.x - halfCord.getCord(abs(b.y - y)), 0); // clipping x + ritorno alle
- xMax = tmin(a.x + halfCord.getCord(abs(y - a.y)), lx - 1); // coordinate "di schermo"
+ xMin = std::max(b.x - halfCord.getCord(abs(b.y - y)), 0); // clipping x + ritorno alle
+ xMax = std::min(a.x + halfCord.getCord(abs(y - a.y)), lx - 1); // coordinate "di schermo"
}
TPixel32 *p = ras->pixels(y) + xMin;
TPixel32 *q = p + (xMax - xMin);
diff --git a/toonz/sources/common/trop/loop_macros.h b/toonz/sources/common/trop/loop_macros.h
index f19d8a752..f5d20c700 100644
--- a/toonz/sources/common/trop/loop_macros.h
+++ b/toonz/sources/common/trop/loop_macros.h
@@ -125,8 +125,8 @@
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); \
} \
} \
- kMin = tmax(kMinX, kMinY, (int)0); \
- kMax = tmin(kMaxX, kMaxY, xMax - xMin); \
+ kMin = std::max({kMinX, kMinY, (int)0}); \
+ kMax = std::min(kMaxX, kMaxY, xMax - xMin); \
dnPix = dnRow + xMin + kMin; \
dnEndPix = dnRow + xMin + kMax + 1; \
xL = xL0 + (kMin - 1) * deltaXL; \
diff --git a/toonz/sources/common/trop/quickput.cpp b/toonz/sources/common/trop/quickput.cpp
index bbf9611b7..13843816f 100644
--- a/toonz/sources/common/trop/quickput.cpp
+++ b/toonz/sources/common/trop/quickput.cpp
@@ -85,7 +85,7 @@ void doQuickPutFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getSize())) *
(aff * TRectD(0, 0, up->getLx() - 2, up->getLy() - 2));
@@ -94,16 +94,16 @@ void doQuickPutFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -245,8 +245,8 @@ void doQuickPutFilter(
}
// calcola kMin, kMax effettuando anche il clipping su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -360,7 +360,7 @@ void doQuickPutNoFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -370,16 +370,16 @@ void doQuickPutNoFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -534,8 +534,8 @@ void doQuickPutNoFilter(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -605,7 +605,7 @@ void doQuickPutNoFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -615,16 +615,16 @@ void doQuickPutNoFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -779,8 +779,8 @@ void doQuickPutNoFilter(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -832,7 +832,7 @@ void doQuickPutNoFilter(
if ((aff.a11 * aff.a22 - aff.a12 * aff.a21) == 0)
return;
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -840,13 +840,13 @@ void doQuickPutNoFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff);
@@ -935,8 +935,8 @@ void doQuickPutNoFilter(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -1003,7 +1003,7 @@ void doQuickPutFilter(
// maschera del filtro bilineare
const int MASKN = (1 << PADN) - 1;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
@@ -1016,16 +1016,16 @@ void doQuickPutFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -1133,8 +1133,8 @@ void doQuickPutFilter(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con
// i lati (x = xMin) e (x = xMax) di up
@@ -1158,8 +1158,8 @@ void doQuickPutFilter(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -1277,7 +1277,7 @@ void doQuickPutNoFilter(
// contatore bit di shift
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
@@ -1290,16 +1290,16 @@ void doQuickPutNoFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -1411,8 +1411,8 @@ void doQuickPutNoFilter(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -1436,8 +1436,8 @@ void doQuickPutNoFilter(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -1515,7 +1515,7 @@ void doQuickPutNoFilter(
return;
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TAffine aff(sx, 0, tx, 0, sy, ty);
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
@@ -1524,10 +1524,10 @@ void doQuickPutNoFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -1563,8 +1563,8 @@ void doQuickPutNoFilter(
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); // ceil
}
}
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
if (deltaXL > 0) // (deltaXL != 0)
{
@@ -1583,8 +1583,8 @@ void doQuickPutNoFilter(
kMinX = (xL0 - lxPred - deltaXL - 1) / (-deltaXL); // ceil
}
}
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -1658,7 +1658,7 @@ void doQuickResampleFilter(
// maschera del filtro bilineare
const int MASKN = (1 << PADN) - 1;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
@@ -1670,16 +1670,16 @@ void doQuickResampleFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -1827,8 +1827,8 @@ void doQuickResampleFilter(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -1917,7 +1917,7 @@ void doQuickResampleFilter(
const int PADN = 16;
const int MASKN = (1 << PADN) - 1;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getSize())) *
(aff * TRectD(0, 0, up->getLx() - 2, up->getLy() - 2));
@@ -1926,10 +1926,10 @@ void doQuickResampleFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -2002,8 +2002,8 @@ void doQuickResampleFilter(
}
}
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -2068,7 +2068,7 @@ void doQuickResampleColorFilter(
return;
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -2076,10 +2076,10 @@ void doQuickResampleColorFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0); // clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0); // clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0); // clipping y su dn
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0); // clipping x su dn
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
TAffine invAff = inv(aff); // inversa di aff
@@ -2144,8 +2144,8 @@ void doQuickResampleColorFilter(
if (lyPred < yL0)
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); // ceil
}
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
int xL = xL0 + (kMin - 1) * deltaXL; // inizializza xL
@@ -2191,7 +2191,7 @@ void doQuickResampleColorFilter(
return;
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -2199,10 +2199,10 @@ void doQuickResampleColorFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0); // clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0); // clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0); // clipping y su dn
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0); // clipping x su dn
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
TAffine invAff = inv(aff); // inversa di aff
@@ -2267,8 +2267,8 @@ void doQuickResampleColorFilter(
if (lyPred < yL0)
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); // ceil
}
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
int xL = xL0 + (kMin - 1) * deltaXL; // inizializza xL
@@ -2319,7 +2319,7 @@ void doQuickResampleFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TAffine aff(sx, 0, tx, 0, sy, ty);
TRectD boundingBoxD = TRectD(convert(dn->getSize())) *
@@ -2330,16 +2330,16 @@ void doQuickResampleFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -2434,8 +2434,8 @@ void doQuickResampleFilter(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -2459,8 +2459,8 @@ void doQuickResampleFilter(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -2572,7 +2572,7 @@ void doQuickResampleFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TAffine aff(sx, 0, tx, 0, sy, ty);
TRectD boundingBoxD = TRectD(convert(dn->getSize())) *
@@ -2583,16 +2583,16 @@ void doQuickResampleFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -2687,8 +2687,8 @@ void doQuickResampleFilter(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -2712,8 +2712,8 @@ void doQuickResampleFilter(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -2804,7 +2804,7 @@ void doQuickResampleNoFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TAffine aff(sx, 0, tx, 0, sy, ty);
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
@@ -2814,16 +2814,16 @@ void doQuickResampleNoFilter(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -2909,8 +2909,8 @@ void doQuickResampleNoFilter(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -2934,8 +2934,8 @@ void doQuickResampleNoFilter(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -3011,7 +3011,7 @@ void doQuickPutCmapped(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -3021,16 +3021,16 @@ void doQuickPutCmapped(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -3196,8 +3196,8 @@ void doQuickPutCmapped(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -3291,15 +3291,15 @@ void doQuickPutCmapped(
if ((aff.a11 * aff.a22 - aff.a12 * aff.a21) == 0)
return;
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff);
double deltaXD = invAff.a11;
double deltaYD = invAff.a21;
@@ -3372,8 +3372,8 @@ void doQuickPutCmapped(
if (lyPred < yL0)
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); // ceil
}
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
@@ -3474,7 +3474,7 @@ void doQuickPutCmapped(
// contatore bit di shift
const int PADN = 16;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
@@ -3487,16 +3487,16 @@ void doQuickPutCmapped(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -3608,8 +3608,8 @@ void doQuickPutCmapped(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -3633,13 +3633,13 @@ void doQuickPutCmapped(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
- int count = tmax(palette->getStyleCount(), TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ int count = std::max({palette->getStyleCount(), TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(count, TPixel32::Red);
std::vector<TPixel32> inks(count, TPixel32::Red);
@@ -3753,7 +3753,7 @@ void doQuickResampleColorFilter(
for (int i = 0; i < plt->getStyleCount(); i++)
paints[i] = inks[i] = ::premultiply(plt->getStyle(i)->getAverageColor());
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -3761,10 +3761,10 @@ void doQuickResampleColorFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0); // clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0); // clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0); // clipping y su dn
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0); // clipping x su dn
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
TAffine invAff = inv(aff); // inversa di aff
@@ -3829,8 +3829,8 @@ void doQuickResampleColorFilter(
if (lyPred < yL0)
kMinY = (yL0 - lyPred - deltaYL - 1) / (-deltaYL); // ceil
}
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
TPixel32 *dnPix = dnRow + xMin + kMin;
TPixel32 *dnEndPix = dnRow + xMin + kMax + 1;
int xL = xL0 + (kMin - 1) * deltaXL; // inizializza xL
@@ -3894,7 +3894,7 @@ void doQuickResampleFilter_optimized(
// maschera del filtro bilineare
const int MASKN = (1 << PADN) - 1;
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
@@ -3906,16 +3906,16 @@ void doQuickResampleFilter_optimized(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
TAffine invAff = inv(aff); // inversa di aff
@@ -4054,7 +4054,7 @@ void doQuickResampleFilter_optimized(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TAffine aff(sx, 0, tx, 0, sy, ty);
TRectD boundingBoxD = TRectD(convert(dn->getSize())) *
@@ -4065,16 +4065,16 @@ void doQuickResampleFilter_optimized(
return;
// clipping y su dn
- int yMin = tmax(tfloor(boundingBoxD.y0), 0);
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0);
// clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1);
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1);
// clipping x su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0);
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0);
// clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1);
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1);
// inversa di aff
TAffine invAff = inv(aff);
@@ -4169,8 +4169,8 @@ void doQuickResampleFilter_optimized(
}
}
// calcola kMinY, kMaxY effettuando anche il clippind su dn
- kMinY = tmax(kMinY, (int)0);
- kMaxY = tmin(kMaxY, yMax - yMin);
+ kMinY = std::max(kMinY, (int)0);
+ kMaxY = std::min(kMaxY, yMax - yMin);
// calcola kMinX, kMaxX intersecando la (2) con i lati
// (x = xMin) e (x = xMax) di up
@@ -4194,8 +4194,8 @@ void doQuickResampleFilter_optimized(
}
}
// calcola kMinX, kMaxX effettuando anche il clippind su dn
- kMinX = tmax(kMinX, (int)0);
- kMaxX = tmin(kMaxX, xMax - xMin);
+ kMinX = std::max(kMinX, (int)0);
+ kMaxX = std::min(kMaxX, xMax - xMin);
int dnWrap = dn->getWrap();
int upWrap = up->getWrap();
@@ -4409,7 +4409,7 @@ void doQuickResampleNoFilter(
// max dimensioni di up gestibili (limite imposto dal numero di bit
// disponibili per la parte intera di xL, yL)
- assert(tmax(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
+ assert(std::max(up->getLx(), up->getLy()) < (1 << (8 * sizeof(int) - PADN - 1)));
TRectD boundingBoxD = TRectD(convert(dn->getBounds())) *
(aff * TRectD(-0.5, -0.5, up->getLx() - 0.5, up->getLy() - 0.5));
@@ -4417,10 +4417,10 @@ void doQuickResampleNoFilter(
if (boundingBoxD.x0 >= boundingBoxD.x1 || boundingBoxD.y0 >= boundingBoxD.y1)
return;
- int yMin = tmax(tfloor(boundingBoxD.y0), 0); // clipping y su dn
- int yMax = tmin(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
- int xMin = tmax(tfloor(boundingBoxD.x0), 0); // clipping x su dn
- int xMax = tmin(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
+ int yMin = std::max(tfloor(boundingBoxD.y0), 0); // clipping y su dn
+ int yMax = std::min(tceil(boundingBoxD.y1), dn->getLy() - 1); // clipping y su dn
+ int xMin = std::max(tfloor(boundingBoxD.x0), 0); // clipping x su dn
+ int xMax = std::min(tceil(boundingBoxD.x1), dn->getLx() - 1); // clipping x su dn
TAffine invAff = inv(aff); // inversa di aff
@@ -4550,8 +4550,8 @@ void doQuickResampleNoFilter(
}
// calcola kMin, kMax effettuando anche il clippind su dn
- int kMin = tmax(kMinX, kMinY, (int)0);
- int kMax = tmin(kMaxX, kMaxY, xMax - xMin);
+ int kMin = std::max({kMinX, kMinY, (int)0});
+ int kMax = std::min({kMaxX, kMaxY, xMax - xMin});
PIX *dnPix = dnRow + xMin + kMin;
PIX *dnEndPix = dnRow + xMin + kMax + 1;
diff --git a/toonz/sources/common/trop/raster_edge_evaluator.hpp b/toonz/sources/common/trop/raster_edge_evaluator.hpp
index c73b094b2..028c1ffcc 100644
--- a/toonz/sources/common/trop/raster_edge_evaluator.hpp
+++ b/toonz/sources/common/trop/raster_edge_evaluator.hpp
@@ -84,7 +84,7 @@ RasterEdgeEvaluator<RanIt>::furthestFrom(const iterator_type &start)
if (cross(displace, rightConstraint) > 0)
break;
- if (tmax(displace.x, -displace.x, displace.y, -displace.y) > m_tolerance) {
+ if (std::max({displace.x, -displace.x, displace.y, -displace.y}) > m_tolerance) {
//Update m_tolerance constraints
newLeftConstraint.x = displace.x +
(displace.y < 0 || (displace.y == 0 && displace.x < 0) ? m_tolerance : -m_tolerance);
@@ -111,7 +111,7 @@ RasterEdgeEvaluator<RanIt>::furthestFrom(const iterator_type &start)
if (jt != this->m_end)
--jt; //Chop Right
- return start + tmax((int)tmin(jt - start - 1, this->m_end - this->m_begin - 2), 1);
+ return start + std::max((int)std::min(jt - start - 1, this->m_end - this->m_begin - 2), 1);
}
#endif // RASTER_EDGE_EVALUATOR_HPP
diff --git a/toonz/sources/common/trop/tantialias.cpp b/toonz/sources/common/trop/tantialias.cpp
index 47cb38f76..935fec0ce 100644
--- a/toonz/sources/common/trop/tantialias.cpp
+++ b/toonz/sources/common/trop/tantialias.cpp
@@ -43,10 +43,11 @@ public:
bool areEqual(const PIX &a, const PIX &b) const
{
- return tmax(abs((int)a.r - b.r),
- abs((int)a.g - b.g),
- abs((int)a.b - b.b),
- abs((int)a.m - b.m)) < m_thresh;
+ return std::max({
+ abs((int)a.r - b.r),
+ abs((int)a.g - b.g),
+ abs((int)a.b - b.b),
+ abs((int)a.m - b.m)}) < m_thresh;
}
};
@@ -156,7 +157,7 @@ inline void filterLine(PIX *inLPix, PIX *inUPix, PIX *outLPix, PIX *outUPix,
double h0 = hStart, h1, area;
double base = hStart / slope;
- int i, end = tmin(tfloor(base), ll);
+ int i, end = std::min(tfloor(base), ll);
if (filterLower) {
//Filter lower line
for (i = 0; i < end; ++i, h0 = h1,
diff --git a/toonz/sources/common/trop/tblur.cpp b/toonz/sources/common/trop/tblur.cpp
index 0a8f75428..acad3cd4d 100644
--- a/toonz/sources/common/trop/tblur.cpp
+++ b/toonz/sources/common/trop/tblur.cpp
@@ -33,8 +33,6 @@ struct BlurPixel {
//===================================================================
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-
#define LOAD_COL_CODE \
\
buffer += x; \
@@ -497,7 +495,7 @@ inline void blur_code_SSE2(
ampl = 1.0 + blur / 15.0; \
\
if (backlit) \
- for (i = ((dy >= 0) ? 0 : -dy); i < MIN(ly, r_ly - dy); i++) { \
+ for (i = ((dy >= 0) ? 0 : -dy); i < std::min(ly, r_ly - dy); i++) { \
val = troundp(col[i].r * ampl); \
buffer->r = (val > crop_val) ? crop_val : val; \
val = troundp(col[i].g * ampl); \
@@ -509,7 +507,7 @@ inline void blur_code_SSE2(
buffer += wrap; \
} \
else \
- for (i = ((dy >= 0) ? 0 : -dy); i < MIN(ly, r_ly - dy); i++) { \
+ for (i = ((dy >= 0) ? 0 : -dy); i < std::min(ly, r_ly - dy); i++) { \
*buffer = col[i]; \
buffer += wrap; \
} \
@@ -541,7 +539,7 @@ void store_colGray(T *buffer, int wrap, int r_ly, T *col,
ampl = 1.0 + blur / 15.0;
- for (i = ((dy >= 0) ? 0 : -dy); i < MIN(ly, r_ly - dy); i++) {
+ for (i = ((dy >= 0) ? 0 : -dy); i < std::min(ly, r_ly - dy); i++) {
*buffer = col[i];
buffer += wrap;
}
@@ -856,7 +854,7 @@ void doBlurRgb(TRasterPT<T> &dstRas, TRasterPT<T> &srcRas, double blur, int dx,
if (dy >= 0)
buffer += (dstRas->getWrap()) * dy;
- for (i = (dx >= 0) ? 0 : -dx; i < tmin(llx, dstRas->getLx() - dx); i++) {
+ for (i = (dx >= 0) ? 0 : -dx; i < std::min(llx, dstRas->getLx() - dx); i++) {
load_colRgb<P>(fbuffer, col1 + brad, llx, ly, i, brad, by1, by2);
do_filtering_chan<T, Q, P>(col1 + brad, col2, lly, coeff, coeffq, brad, diff, useSSE);
store_colRgb<T>(buffer, dstRas->getWrap(), dstRas->getLy(), col2, lly, i + dx, dy, 0, blur);
@@ -935,7 +933,7 @@ void doBlurGray(TRasterPT<T> &dstRas, TRasterPT<T> &srcRas, double blur, int dx,
if (dy >= 0)
buffer += (dstRas->getWrap()) * dy;
- for (i = (dx >= 0) ? 0 : -dx; i < tmin(llx, dstRas->getLx() - dx); i++) {
+ for (i = (dx >= 0) ? 0 : -dx; i < std::min(llx, dstRas->getLx() - dx); i++) {
load_channel_col32(fbuffer, col1 + brad, llx, ly, i, brad, by1, by2);
do_filtering_channel_gray<T>(col1 + brad, col2, lly, coeff, coeffq, brad, diff);
diff --git a/toonz/sources/common/trop/tconvolve.cpp b/toonz/sources/common/trop/tconvolve.cpp
index 5c38c4f63..e7f2eed0a 100644
--- a/toonz/sources/common/trop/tconvolve.cpp
+++ b/toonz/sources/common/trop/tconvolve.cpp
@@ -10,9 +10,6 @@
#include <memory>
-#define TMIN(a, b) (a < b ? a : b)
-#define TMAX(a, b) (a > b ? a : b)
-
//------------------------------------------------------------------------------
namespace
@@ -244,10 +241,10 @@ void doConvolve_3_i(TRasterPT<PIXOUT> rout,
wrapout = rout->getWrap();
/* calcolo l'area di output interessata */
- x1 = TMAX(0, -dx - 1);
- y1 = TMAX(0, -dy - 1);
- x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
- y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
+ x1 = std::max(0, -dx - 1);
+ y1 = std::max(0, -dy - 1);
+ x2 = std::min(rout->getLx() - 1, -dx + rin->getLx());
+ y2 = std::min(rout->getLy() - 1, -dy + rin->getLy());
rin->lock();
rout->lock();
@@ -255,8 +252,8 @@ void doConvolve_3_i(TRasterPT<PIXOUT> rout,
bufferout = rout->pixels();
for (y = y1; y <= y2; y++) {
- fy1 = TMAX(-1, -dy - y);
- fy2 = TMIN(1, -dy + rin->getLy() - 1 - y);
+ fy1 = std::max(-1, -dy - y);
+ fy2 = std::min(1, -dy + rin->getLy() - 1 - y);
if (fy1 > fy2)
continue;
x = x1;
@@ -264,10 +261,10 @@ void doConvolve_3_i(TRasterPT<PIXOUT> rout,
pixin = bufferin + wrapin * (y + dy) + (x + dx);
while (x <= x2) {
- fx1 = TMAX(-1, -dx - x);
- fx2 = TMIN(1, -dx + rin->getLx() - 1 - x);
+ fx1 = std::max(-1, -dx - x);
+ fx2 = std::min(1, -dx + rin->getLx() - 1 - x);
if (x > -dx && x < -dx + rin->getLx() - 1)
- n = tmin(-dx + rin->getLx() - 1 - x, x2 - x + 1);
+ n = std::min(-dx + rin->getLx() - 1 - x, x2 - x + 1);
else
n = 1;
if (n < 1)
@@ -322,10 +319,10 @@ void doConvolve_i(TRasterPT<PIXOUT> rout,
wrapout = rout->getWrap();
/* calcolo l'area di output interessata */
- x1 = TMAX(0, -dx - 1);
- y1 = TMAX(0, -dy - 1);
- x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
- y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
+ x1 = std::max(0, -dx - 1);
+ y1 = std::max(0, -dy - 1);
+ x2 = std::min(rout->getLx() - 1, -dx + rin->getLx());
+ y2 = std::min(rout->getLy() - 1, -dy + rin->getLy());
rin->lock();
rout->lock();
@@ -333,8 +330,8 @@ void doConvolve_i(TRasterPT<PIXOUT> rout,
bufferout = rout->pixels();
for (y = y1; y <= y2; y++) {
- fy1 = TMAX(radius0, -dy - y);
- fy2 = TMIN(radius1, -dy - y + rin->getLy() - 1);
+ fy1 = std::max(radius0, -dy - y);
+ fy2 = std::min(radius1, -dy - y + rin->getLy() - 1);
if (fy1 > fy2)
continue;
x = x1;
@@ -342,10 +339,10 @@ void doConvolve_i(TRasterPT<PIXOUT> rout,
pixin = bufferin + wrapin * (y + dy) + (x + dx);
while (x <= x2) {
- fx1 = TMAX(radius0, -dx - x);
- fx2 = TMIN(radius1, -dx - x + rin->getLx() - 1);
+ fx1 = std::max(radius0, -dx - x);
+ fx2 = std::min(radius1, -dx - x + rin->getLx() - 1);
if (x > -dx && x < -dx + rin->getLx() - 1)
- n = tmin(-dx + rin->getLx() - 1 - x, x2 - x + 1);
+ n = std::min(-dx + rin->getLx() - 1 - x, x2 - x + 1);
else
n = 1;
if (n < 1)
@@ -395,13 +392,13 @@ void doConvolve_cm32_3_i(TRasterPT<PIXOUT> rout,
wrapout = rout->getWrap();
/* calcolo l'area di output interessata */
- x1 = TMAX(0, -dx - 1);
- y1 = TMAX(0, -dy - 1);
- x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
- y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
+ x1 = std::max(0, -dx - 1);
+ y1 = std::max(0, -dy - 1);
+ x2 = std::min(rout->getLx() - 1, -dx + rin->getLx());
+ y2 = std::min(rout->getLy() - 1, -dy + rin->getLy());
int colorCount = palette->getStyleCount();
- colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ colorCount = std::max({colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(colorCount);
std::vector<TPixel32> inks(colorCount);
@@ -415,8 +412,8 @@ void doConvolve_cm32_3_i(TRasterPT<PIXOUT> rout,
paints[i] = inks[i] = palette->getStyle(i)->getAverageColor();
for (y = y1; y <= y2; y++) {
- fy1 = TMAX(-1, -dy - y);
- fy2 = TMIN(1, -dy + rin->getLy() - 1 - y);
+ fy1 = std::max(-1, -dy - y);
+ fy2 = std::min(1, -dy + rin->getLy() - 1 - y);
if (fy1 > fy2)
continue;
x = x1;
@@ -424,10 +421,10 @@ void doConvolve_cm32_3_i(TRasterPT<PIXOUT> rout,
pixin = bufferin + wrapin * (y + dy) + (x + dx);
while (x <= x2) {
- fx1 = TMAX(-1, -dx - x);
- fx2 = TMIN(1, -dx + rin->getLx() - 1 - x);
+ fx1 = std::max(-1, -dx - x);
+ fx2 = std::min(1, -dx + rin->getLx() - 1 - x);
if (x > -dx && x < -dx + rin->getLx() - 1)
- n = TMIN(-dx + rin->getLx() - 1 - x, x2 - x + 1);
+ n = std::min(-dx + rin->getLx() - 1 - x, x2 - x + 1);
else
n = 1;
if (n < 1)
@@ -480,13 +477,13 @@ void doConvolve_cm32_i(TRasterPT<PIXOUT> rout,
wrapout = rout->getWrap();
/* calcolo l'area di output interessata */
- x1 = TMAX(0, -dx - 1);
- y1 = TMAX(0, -dy - 1);
- x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
- y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
+ x1 = std::max(0, -dx - 1);
+ y1 = std::max(0, -dy - 1);
+ x2 = std::min(rout->getLx() - 1, -dx + rin->getLx());
+ y2 = std::min(rout->getLy() - 1, -dy + rin->getLy());
int colorCount = palette->getStyleCount();
- colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ colorCount = std::max({colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(colorCount);
std::vector<TPixel32> inks(colorCount);
@@ -500,8 +497,8 @@ void doConvolve_cm32_i(TRasterPT<PIXOUT> rout,
paints[i] = inks[i] = palette->getStyle(i)->getAverageColor();
for (y = y1; y <= y2; y++) {
- fy1 = TMAX(radius0, -dy - y);
- fy2 = TMIN(radius1, -dy + rin->getLy() - 1 - y);
+ fy1 = std::max(radius0, -dy - y);
+ fy2 = std::min(radius1, -dy + rin->getLy() - 1 - y);
if (fy1 > fy2)
continue;
x = x1;
@@ -509,10 +506,10 @@ void doConvolve_cm32_i(TRasterPT<PIXOUT> rout,
pixin = bufferin + wrapin * (y + dy) + (x + dx);
while (x <= x2) {
- fx1 = TMAX(radius0, -dx - x);
- fx2 = TMIN(radius1, -dx + rin->getLx() - 1 - x);
+ fx1 = std::max(radius0, -dx - x);
+ fx2 = std::min(radius1, -dx + rin->getLx() - 1 - x);
if (x > -dx && x < -dx + rin->getLx() - 1)
- n = TMIN(-dx + rin->getLx() - 1 - x, x2 - x + 1);
+ n = std::min(-dx + rin->getLx() - 1 - x, x2 - x + 1);
else
n = 1;
if (n < 1)
diff --git a/toonz/sources/common/trop/tdistancetransform.cpp b/toonz/sources/common/trop/tdistancetransform.cpp
index f6175e59f..3a4bf49de 100644
--- a/toonz/sources/common/trop/tdistancetransform.cpp
+++ b/toonz/sources/common/trop/tdistancetransform.cpp
@@ -40,7 +40,7 @@ unsigned int takeoverDist(unsigned int a, unsigned int b, unsigned int d)
// using integers only.
// NOTE: It can be proven that with integer division, x/ab == (x/a)/b.
- return (b < a) ? d : tmax((d + (b - a) / d + 1) / 2, d); // Note the +1 to get the ceil
+ return (b < a) ? d : std::max((d + (b - a) / d + 1) / 2, d); // Note the +1 to get the ceil
}
//--------------------------------------------------------------
@@ -102,7 +102,7 @@ void expand(int lineLength, int linesCount,
}
}
- dtEnd = dtRef + tmin(d, dMax); // Could end the line before (dMax < d)
+ dtEnd = dtRef + std::min(d, dMax); // Could end the line before (dMax < d)
dtNewRef = dtRef + dNew;
}
}; // locals
diff --git a/toonz/sources/common/trop/terodilate.cpp b/toonz/sources/common/trop/terodilate.cpp
index 75e92e64a..519e0a224 100644
--- a/toonz/sources/common/trop/terodilate.cpp
+++ b/toonz/sources/common/trop/terodilate.cpp
@@ -103,12 +103,12 @@ namespace
template <typename Chan>
struct MaxFunc {
- inline Chan operator()(const Chan &a, const Chan &b) { return tmax(a, b); }
+ inline Chan operator()(const Chan &a, const Chan &b) { return std::max(a, b); }
};
template <typename Chan>
struct MinFunc {
- inline Chan operator()(const Chan &a, const Chan &b) { return tmin(a, b); }
+ inline Chan operator()(const Chan &a, const Chan &b) { return std::min(a, b); }
};
//--------------------------------------------------------------
@@ -132,11 +132,11 @@ void erodilate_row(int len, const Chan *src, int sIncr, Chan *dst, int dIncr,
double one_radR = (1.0 - radR);
for (w = 0; w != wCount; ++w) {
- Chan *dwBegin = dst + w * dwIncr, *dwEnd = tmin(dwBegin + dwIncr, dEnd);
+ Chan *dwBegin = dst + w * dwIncr, *dwEnd = std::min(dwBegin + dwIncr, dEnd);
// Compute prefixes
- const Chan *swBegin = src + tmax(w * swIncr - srIncr - sIncr, 0),
- *swEnd = src + tmin(w * swIncr + srIncr + sIncr, len * sIncr);
+ const Chan *swBegin = src + std::max(w * swIncr - srIncr - sIncr, 0),
+ *swEnd = src + std::min(w * swIncr + srIncr + sIncr, len * sIncr);
s = swEnd - sIncr, d = dst + ((s - src) / sIncr) * dIncr + drIncr; // d already decremented by dIncr
@@ -165,7 +165,7 @@ void erodilate_row(int len, const Chan *src, int sIncr, Chan *dst, int dIncr,
*d = (oldVal == val) ? val : one_radR * oldVal + radR * val;
}
- for (d = tmin(d, dEnd - dIncr); d >= dwBegin; d -= dIncr) {
+ for (d = std::min(d, dEnd - dIncr); d >= dwBegin; d -= dIncr) {
assert(d >= dst);
assert(d < dEnd);
assert((d - dst) % dIncr == 0);
@@ -175,7 +175,7 @@ void erodilate_row(int len, const Chan *src, int sIncr, Chan *dst, int dIncr,
}
// Compute suffixes
- swBegin = src + w * swIncr + srIncr, swEnd = tmin(swBegin + swIncr + sIncr, sEnd);
+ swBegin = src + w * swIncr + srIncr, swEnd = std::min(swBegin + swIncr + sIncr, sEnd);
if (swBegin >= swEnd)
continue;
diff --git a/toonz/sources/common/trop/tover.cpp b/toonz/sources/common/trop/tover.cpp
index 384c40ae6..0291c1c01 100644
--- a/toonz/sources/common/trop/tover.cpp
+++ b/toonz/sources/common/trop/tover.cpp
@@ -131,7 +131,7 @@ void do_over(TRasterCM32P rout, const TRasterCM32P &rup)
*outl = ((*upl) & (TPixelCM32::getInkMask())) |
((*outl) & (TPixelCM32::getPaintMask())) |
- tmin(up_pix->getTone(), out_pix->getTone());
+ std::min(up_pix->getTone(), out_pix->getTone());
}
}
}
diff --git a/toonz/sources/common/trop/traylit.cpp b/toonz/sources/common/trop/traylit.cpp
index 58d570151..60e6c230b 100644
--- a/toonz/sources/common/trop/traylit.cpp
+++ b/toonz/sources/common/trop/traylit.cpp
@@ -92,12 +92,12 @@ void performStandardRaylit(T *bufIn, T *bufOut,
if (insideSrc) {
// Add a light component depending on source's matte
if (pixIn->m == opaque_val)
- lightness = tmax(0.0, lightness - neg_delta_p); // No light source - ray fading
+ lightness = std::max(0.0, lightness - neg_delta_p); // No light source - ray fading
else {
if (pixIn->m == transp_val)
lightness += intensity; // Full light source - ray enforcing
else
- lightness = tmax(0.0, lightness + // Half light source
+ lightness = std::max(0.0, lightness + // Half light source
(params.m_invert ? pixIn->m : (max - pixIn->m)) * quot_delta_p); // matte-linear enforcing
}
@@ -112,7 +112,7 @@ void performStandardRaylit(T *bufIn, T *bufOut,
if (!params.m_invert)
lightness += intensity;
else
- lightness = tmax(0.0, lightness - neg_delta_p);
+ lightness = std::max(0.0, lightness - neg_delta_p);
val_r = val_g = val_b = val_m = 0;
}
@@ -210,16 +210,16 @@ void performColorRaylit(T *bufIn, T *bufOut,
val_b = pixIn->b;
val_m = pixIn->m;
- lightness_r = tmax(0.0, val_r ? lightness_r + val_r * quot_delta_p : lightness_r - neg_delta_p);
- lightness_g = tmax(0.0, val_g ? lightness_g + val_g * quot_delta_p : lightness_g - neg_delta_p);
- lightness_b = tmax(0.0, val_b ? lightness_b + val_b * quot_delta_p : lightness_b - neg_delta_p);
+ lightness_r = std::max(0.0, val_r ? lightness_r + val_r * quot_delta_p : lightness_r - neg_delta_p);
+ lightness_g = std::max(0.0, val_g ? lightness_g + val_g * quot_delta_p : lightness_g - neg_delta_p);
+ lightness_b = std::max(0.0, val_b ? lightness_b + val_b * quot_delta_p : lightness_b - neg_delta_p);
if (!params.m_includeInput)
val_r = val_g = val_b = val_m = 0;
} else {
- lightness_r = tmax(0.0, lightness_r - neg_delta_p);
- lightness_g = tmax(0.0, lightness_g - neg_delta_p);
- lightness_b = tmax(0.0, lightness_b - neg_delta_p);
+ lightness_r = std::max(0.0, lightness_r - neg_delta_p);
+ lightness_g = std::max(0.0, lightness_g - neg_delta_p);
+ lightness_b = std::max(0.0, lightness_b - neg_delta_p);
val_r = val_g = val_b = val_m = 0;
}
@@ -235,9 +235,9 @@ void performColorRaylit(T *bufIn, T *bufOut,
val_r += l = (int)(fac * lightness_r + 0.5);
l_max = l;
val_g += l = (int)(fac * lightness_g + 0.5);
- l_max = tmax(l, l_max);
+ l_max = std::max(l, l_max);
val_b += l = (int)(fac * lightness_b + 0.5);
- l_max = tmax(l, l_max);
+ l_max = std::max(l, l_max);
val_m += l_max;
pixOut->r = (val_r > max) ? max : val_r;
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index c6452ea40..155e5a4a6 100644
--- a/toonz/sources/common/trop/tresample.cpp
+++ b/toonz/sources/common/trop/tresample.cpp
@@ -331,18 +331,18 @@ inline void minmax(double u0, double v0,
y_c = affMV2(aff, u1, v1);
x_d = affMV1(aff, u0, v1);
y_d = affMV2(aff, u0, v1);
- xmin = tmin(x_a, x_b);
- xmax = tmax(x_a, x_b);
- xmin = tmin(xmin, x_c);
- xmax = tmax(xmax, x_c);
- xmin = tmin(xmin, x_d);
- xmax = tmax(xmax, x_d);
- ymin = tmin(y_a, y_b);
- ymax = tmax(y_a, y_b);
- ymin = tmin(ymin, y_c);
- ymax = tmax(ymax, y_c);
- ymin = tmin(ymin, y_d);
- ymax = tmax(ymax, y_d);
+ xmin = std::min(x_a, x_b);
+ xmax = std::max(x_a, x_b);
+ xmin = std::min(xmin, x_c);
+ xmax = std::max(xmax, x_c);
+ xmin = std::min(xmin, x_d);
+ xmax = std::max(xmax, x_d);
+ ymin = std::min(y_a, y_b);
+ ymax = std::max(y_a, y_b);
+ ymin = std::min(ymin, y_c);
+ ymax = std::max(ymax, y_c);
+ ymin = std::min(ymin, y_d);
+ ymax = std::max(ymax, y_d);
x0 = xmin;
y0 = ymin;
x1 = xmax;
@@ -758,8 +758,8 @@ INT_GT (2*radx_) = width
uhi_ = ulo_ + du_dx;
ulo = intGE(ulo_);
uhi = intLT(uhi_);
- nocalc[x].first = tmax(umin, ulo);
- nocalc[x].last = tmin(umax, uhi);
+ nocalc[x].first = std::max(umin, ulo);
+ nocalc[x].last = std::min(umax, uhi);
}
xwidth = width;
@@ -2013,10 +2013,10 @@ static void rop_resample_gr8(const TRasterGR8P &rin, TRasterGR8P rout,
NOT_LESS_THAN(0, ylo);
NOT_MORE_THAN(my, yhi);
#endif
- xlo = tmax(0, (int)xlo_);
- xhi = tmin(mx, (int)xhi_);
- ylo = tmax(0, (int)ylo_);
- yhi = tmin(my, (int)yhi_);
+ xlo = std::max(0, (int)xlo_);
+ xhi = std::min(mx, (int)xhi_);
+ ylo = std::max(0, (int)ylo_);
+ yhi = std::min(my, (int)yhi_);
for (y = ylo; y <= yhi; y++)
for (x = xlo; x <= xhi; x++)
bufout_gr8[x + y * wrapout] = flatval, count++;
@@ -2227,10 +2227,10 @@ static void rop_resample_rgbm32_gr8(const TRaster32P &rin, TRasterGR8P rout,
NOT_LESS_THAN(0, ylo);
NOT_MORE_THAN(my, yhi);
#endif
- xlo = tmax(0, (int)xlo_);
- xhi = tmin(mx, (int)xhi_);
- ylo = tmax(0, (int)ylo_);
- yhi = tmin(my, (int)yhi_);
+ xlo = std::max(0, (int)xlo_);
+ xhi = std::min(mx, (int)xhi_);
+ ylo = std::max(0, (int)ylo_);
+ yhi = std::min(my, (int)yhi_);
for (y = ylo; y <= yhi; y++)
for (x = xlo; x <= xhi; x++)
bufout_gr8[x + y * wrapout] = flatval, count++;
@@ -2589,8 +2589,8 @@ void rop_resample_rgbm(TRasterPT<T> rout, const TRasterPT<T> &rin,
#endif
//Considering the bounding square in fg
- min_pix_out_fg = tmin(min_pix_out_f, min_pix_out_g);
- max_pix_out_fg = tmax(max_pix_out_f, max_pix_out_g);
+ min_pix_out_fg = std::min(min_pix_out_f, min_pix_out_g);
+ max_pix_out_fg = std::max(max_pix_out_f, max_pix_out_g);
if (min_pix_out_fg < min_filter_fg || max_pix_out_fg > max_filter_fg) {
//Reallocate the filter... and so on...
filter_size = max_pix_out_fg - min_pix_out_fg + 1;
@@ -3382,7 +3382,7 @@ void resample_main_cm32_rgbm_SSE2(TRasterPT<T> rout, const TRasterCM32P &rin,
outside_max_v_ = lv - 0.5;
int count = palette->getStyleCount();
- int count2 = tmax(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ int count2 = std::max({count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
TPixelFloat *paints = (TPixelFloat *)_aligned_malloc(count2 * sizeof(TPixelFloat), 16);
TPixelFloat *inks = (TPixelFloat *)_aligned_malloc(count2 * sizeof(TPixelFloat), 16);
@@ -3667,7 +3667,7 @@ void resample_main_cm32_rgbm_bigradius(TRasterPT<T> rout, const TRasterCM32P &ri
outside_max_v_ = lv - 0.5;
int colorCount = palette->getStyleCount();
- colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ colorCount = std::max({colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(colorCount);
std::vector<TPixel32> inks(colorCount);
@@ -3962,7 +3962,7 @@ void resample_main_cm32_rgbm(TRasterPT<T> rout, const TRasterCM32P &rin,
outside_max_v_ = lv - 0.5;
int colorCount = palette->getStyleCount();
- colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ colorCount = std::max({colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(colorCount);
std::vector<TPixel32> inks(colorCount);
@@ -4236,7 +4236,7 @@ void resample_cm32_rgbm(TRaster32P rout, const TRasterCM32P &rin,
}
int colorCount = palette->getStyleCount();
- colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ colorCount = std::max({colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
std::vector<TPixel32> paints(colorCount);
std::vector<TPixel32> inks(colorCount);
@@ -4678,8 +4678,8 @@ void rop_resample_rgbm_2(TRasterPT<T> rout, const TRasterCM32P &rin,
}
#endif
- min_pix_out_fg = tmin(min_pix_out_f, min_pix_out_g);
- max_pix_out_fg = tmax(max_pix_out_f, max_pix_out_g);
+ min_pix_out_fg = std::min(min_pix_out_f, min_pix_out_g);
+ max_pix_out_fg = std::max(max_pix_out_f, max_pix_out_g);
if (min_pix_out_fg < min_filter_fg || max_pix_out_fg > max_filter_fg) {
filter_size = max_pix_out_fg - min_pix_out_fg + 1;
if (filter_size > filter_array_size) {
diff --git a/toonz/sources/common/trop/trgbmscale.cpp b/toonz/sources/common/trop/trgbmscale.cpp
index ff1f9157b..656219d5d 100644
--- a/toonz/sources/common/trop/trgbmscale.cpp
+++ b/toonz/sources/common/trop/trgbmscale.cpp
@@ -42,7 +42,7 @@ void do_greyScale_lut(TRasterPT<T> rout, TRasterPT<T> rin,
int chanValuesCount = T::maxChannelValue + 1;
int fac = chanValuesCount / 256;
- out0 = tmax(fac * out0, 0), out1 = tmin(fac * out1, T::maxChannelValue);
+ out0 = std::max(fac * out0, 0), out1 = std::min(fac * out1, T::maxChannelValue);
//Build lut
Channel *lut = new Channel[chanValuesCount];
@@ -91,10 +91,10 @@ void do_rgbmScale_lut(TRasterPT<T> rout, TRasterPT<T> rin,
int m, max = T::maxChannelValue, chanValuesCount = max + 1;
int fac = chanValuesCount / 256;
- int out0R = tmax(fac * out0[0], 0), out1R = tmin(fac * out1[0], T::maxChannelValue);
- int out0G = tmax(fac * out0[1], 0), out1G = tmin(fac * out1[1], T::maxChannelValue);
- int out0B = tmax(fac * out0[2], 0), out1B = tmin(fac * out1[2], T::maxChannelValue);
- int out0M = tmax(fac * out0[3], 0), out1M = tmin(fac * out1[3], T::maxChannelValue);
+ int out0R = std::max(fac * out0[0], 0), out1R = std::min(fac * out1[0], T::maxChannelValue);
+ int out0G = std::max(fac * out0[1], 0), out1G = std::min(fac * out1[1], T::maxChannelValue);
+ int out0B = std::max(fac * out0[2], 0), out1B = std::min(fac * out1[2], T::maxChannelValue);
+ int out0M = std::max(fac * out0[3], 0), out1M = std::min(fac * out1[3], T::maxChannelValue);
//Build luts
Channel *lut_r = new Channel[chanValuesCount];
@@ -125,9 +125,9 @@ void do_rgbmScale_lut(TRasterPT<T> rout, TRasterPT<T> rin,
depremFac = lut_deprem[in->m];
premFac = lut_prem[m];
- out->r = premFac * lut_r[tmin((int)(in->r * depremFac), max)];
- out->g = premFac * lut_g[tmin((int)(in->g * depremFac), max)];
- out->b = premFac * lut_b[tmin((int)(in->b * depremFac), max)];
+ out->r = premFac * lut_r[std::min((int)(in->r * depremFac), max)];
+ out->g = premFac * lut_g[std::min((int)(in->g * depremFac), max)];
+ out->b = premFac * lut_b[std::min((int)(in->b * depremFac), max)];
out->m = m;
}
}
@@ -152,10 +152,10 @@ void do_rgbmScale(TRasterPT<T> rout, TRasterPT<T> rin,
int fac = chanValuesCount / 256;
- int out0R = tmax(fac * out0[0], 0), out1R = tmin(fac * out1[0], T::maxChannelValue);
- int out0G = tmax(fac * out0[1], 0), out1G = tmin(fac * out1[1], T::maxChannelValue);
- int out0B = tmax(fac * out0[2], 0), out1B = tmin(fac * out1[2], T::maxChannelValue);
- int out0M = tmax(fac * out0[3], 0), out1M = tmin(fac * out1[3], T::maxChannelValue);
+ int out0R = std::max(fac * out0[0], 0), out1R = std::min(fac * out1[0], T::maxChannelValue);
+ int out0G = std::max(fac * out0[1], 0), out1G = std::min(fac * out1[1], T::maxChannelValue);
+ int out0B = std::max(fac * out0[2], 0), out1B = std::min(fac * out1[2], T::maxChannelValue);
+ int out0M = std::max(fac * out0[3], 0), out1M = std::min(fac * out1[3], T::maxChannelValue);
//Retrieve de/premultiplication luts
const double *lut_prem = premultiplyTable<Channel>();
@@ -205,14 +205,14 @@ void do_rgbmAdjust(TRasterPT<T> rout, TRasterPT<T> rin, ScaleFunc scaleFunc,
//Ensure that the output is cropped according to output params
int out0i[4], out1i[4];
- out0i[0] = tmax(out0[0], tcrop((int)(a[0] + k[0] * out0[1]), 0, 255));
- out1i[0] = tmin(out1[0], tcrop((int)(a[0] + k[0] * out1[1]), 0, 255));
+ out0i[0] = std::max(out0[0], tcrop((int)(a[0] + k[0] * out0[1]), 0, 255));
+ out1i[0] = std::min(out1[0], tcrop((int)(a[0] + k[0] * out1[1]), 0, 255));
- out0i[1] = tmax(out0[0], tcrop((int)(a[0] + k[0] * out0[2]), 0, 255));
- out1i[1] = tmin(out1[0], tcrop((int)(a[0] + k[0] * out1[2]), 0, 255));
+ out0i[1] = std::max(out0[0], tcrop((int)(a[0] + k[0] * out0[2]), 0, 255));
+ out1i[1] = std::min(out1[0], tcrop((int)(a[0] + k[0] * out1[2]), 0, 255));
- out0i[2] = tmax(out0[0], tcrop((int)(a[0] + k[0] * out0[3]), 0, 255));
- out1i[2] = tmin(out1[0], tcrop((int)(a[0] + k[0] * out1[3]), 0, 255));
+ out0i[2] = std::max(out0[0], tcrop((int)(a[0] + k[0] * out0[3]), 0, 255));
+ out1i[2] = std::min(out1[0], tcrop((int)(a[0] + k[0] * out1[3]), 0, 255));
out0i[3] = out0[4];
out1i[3] = out1[4];
diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp
index 0edf20bd5..350b2af42 100644
--- a/toonz/sources/common/trop/tropcm.cpp
+++ b/toonz/sources/common/trop/tropcm.cpp
@@ -67,7 +67,7 @@ void TRop::convert(const TRaster32P &rasOut,
bool transparencyCheck)
{
int count = palette->getStyleCount();
- int count2 = tmax(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ int count2 = std::max({count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint()});
// per poter utilizzare lo switch (piu' efficiente) si utilizza 255
// anziche' TPixelCM32::getMaxTone()
@@ -1133,7 +1133,7 @@ void TRop::zoomOutCm32Rgbm(const TRasterCM32P &rin, TRaster32P &rout, const TPal
int fac_fac_4;
int count = plt.getStyleCount();
- int count2 = tmax(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ int count2 = std::max(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
std::vector<TPixel32> colors(count2);
for (i = 0; i < plt.getStyleCount(); i++)
colors[i] = ::premultiply(plt.getStyle(i)->getAverageColor());
@@ -1269,7 +1269,7 @@ void TRop::makeIcon(TRaster32P &_rout, const TRasterCM32P &rin, const TPaletteP
int ly = rin->getLy();
int count = palette->getStyleCount();
- int count2 = tmax(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
+ int count2 = std::max(count, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
std::vector<TPixel32> colors(count2);
for (i = 0; i < palette->getStyleCount(); i++)
colors[i] = /*::premultiply(*/ palette->getStyle(i)->getAverageColor(); //);
diff --git a/toonz/sources/common/tsound/tsop.cpp b/toonz/sources/common/tsound/tsop.cpp
index dfcc7b69e..0d3098796 100644
--- a/toonz/sources/common/tsound/tsop.cpp
+++ b/toonz/sources/common/tsound/tsop.cpp
@@ -242,7 +242,7 @@ void convertSamplesT(TSoundTrackT<T1> &dst, const TSoundTrackT<T2> &src)
const T2 *srcSample = src.samples();
T1 *dstSample = dst.samples();
- const T2 *srcEndSample = srcSample + tmin(src.getSampleCount(), dst.getSampleCount());
+ const T2 *srcEndSample = srcSample + std::min(src.getSampleCount(), dst.getSampleCount());
while (srcSample < srcEndSample) {
*dstSample = T1::from(*srcSample);
++dstSample;
@@ -326,11 +326,11 @@ T *resampleT(T &src, TINT32 sampleRate, FLT_TYPE flt_type)
int iwFirst, iwLast;
if (is > 0) {
iwFirst = 0;
- iwLast = tmin<int>(filter.weightset[ip].n_weights, src.getSampleCount() - is);
+ iwLast = std::min<int>(filter.weightset[ip].n_weights, src.getSampleCount() - is);
} else {
iwFirst = -is;
is = 0;
- iwLast = tmin<int>(filter.weightset[ip].n_weights, src.getSampleCount());
+ iwLast = std::min<int>(filter.weightset[ip].n_weights, src.getSampleCount());
}
double dstChannel[2];
@@ -780,7 +780,7 @@ TSoundTrackP doReverb(
// int channelCount = src->getChannelCount();
- endDstSample = dst->samples() + tmin(dstSampleCount, (TINT32)src->getSampleCount());
+ endDstSample = dst->samples() + std::min(dstSampleCount, (TINT32)src->getSampleCount());
while (dstSample < endDstSample) {
//*dstSample = *srcSample + *(dstSample - k)*decayFactor;
*dstSample = T::mix(*srcSample, 1, *(dstSample - k), decayFactor);
@@ -1114,7 +1114,7 @@ TSoundTrackP doEcho(
// out(i) = in(i) + decayFactor * in(i - k)
bool chans = src->getChannelCount() == 2;
- endDstSample = dst->samples() + tmin(dstSampleCount, (TINT32)src->getSampleCount());
+ endDstSample = dst->samples() + std::min(dstSampleCount, (TINT32)src->getSampleCount());
while (dstSample < endDstSample) {
//*dstSample = *srcSample + *(srcSample - k)*decayFactor;
ChannelValueType val =
@@ -1263,8 +1263,8 @@ TSoundTrackP TSop::remove(TSoundTrackP src, TINT32 s0, TINT32 s1, TSoundTrackP &
{
TINT32 ss0, ss1;
- ss0 = tmax<TINT32>((TINT32)0, s0);
- ss1 = tmin(s1, (TINT32)(src->getSampleCount() - 1));
+ ss0 = std::max<TINT32>((TINT32)0, s0);
+ ss1 = std::min(s1, (TINT32)(src->getSampleCount() - 1));
TSoundTrackP soundTrackSlice;
if (ss0 <= ss1)
soundTrackSlice = src->extract(ss0, ss1);
@@ -1303,7 +1303,7 @@ template <class T>
TSoundTrackP mixT(
TSoundTrackT<T> *st1, double a1, TSoundTrackT<T> *st2, double a2)
{
- TINT32 sampleCount = tmax(st1->getSampleCount(), st2->getSampleCount());
+ TINT32 sampleCount = std::max(st1->getSampleCount(), st2->getSampleCount());
TSoundTrackT<T> *dst = new TSoundTrackT<T>(
st1->getSampleRate(),
@@ -1311,7 +1311,7 @@ TSoundTrackP mixT(
sampleCount);
T *dstSample = dst->samples();
- T *endDstSample = dstSample + tmin(st1->getSampleCount(), st2->getSampleCount());
+ T *endDstSample = dstSample + std::min(st1->getSampleCount(), st2->getSampleCount());
T *st1Sample = st1->samples();
T *st2Sample = st2->samples();
diff --git a/toonz/sources/common/tsystem/tbigmemorymanager.cpp b/toonz/sources/common/tsystem/tbigmemorymanager.cpp
index c8f8e1ad3..13872b424 100644
--- a/toonz/sources/common/tsystem/tbigmemorymanager.cpp
+++ b/toonz/sources/common/tsystem/tbigmemorymanager.cpp
@@ -275,7 +275,7 @@ bool TBigMemoryManager::putRaster(TRaster *ras, bool canPutOnDisk)
{
if (!ras->m_parent) {
int sizeKB = size >> 10;
- allocationPeakKB = tmax(allocationPeakKB, sizeKB);
+ allocationPeakKB = std::max(allocationPeakKB, sizeKB);
allocationSumKB += sizeKB;
allocationCount++;
}
diff --git a/toonz/sources/common/tvectorimage/outlineApproximation.cpp b/toonz/sources/common/tvectorimage/outlineApproximation.cpp
index 50f93389e..bca542532 100644
--- a/toonz/sources/common/tvectorimage/outlineApproximation.cpp
+++ b/toonz/sources/common/tvectorimage/outlineApproximation.cpp
@@ -413,7 +413,7 @@ void copy(/*std::ofstream& cout,*/
const std::vector<TQuadratic *> &arrayDown,
outlineBoundary &ob)
{
- int minSize = tmin(arrayUp.size(), arrayDown.size());
+ int minSize = std::min(arrayUp.size(), arrayDown.size());
assert(minSize > 0);
diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.cpp b/toonz/sources/common/tvectorimage/tcomputeregions.cpp
index 26b2e1d7a..4d3fc4add 100644
--- a/toonz/sources/common/tvectorimage/tcomputeregions.cpp
+++ b/toonz/sources/common/tvectorimage/tcomputeregions.cpp
@@ -1041,7 +1041,7 @@ double nearCrossVal(TStroke *s0, double w0, TStroke *s1, double w1)
{
double ltot0 = s0->getLength();
double ltot1 = s1->getLength();
- double dl = tmin(ltot1, ltot0) / 1000;
+ double dl = std::min(ltot1, ltot0) / 1000;
double crossVal, dl0 = dl, dl1 = dl;
@@ -1457,20 +1457,20 @@ bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, TStr
p1.thick = p0.thick;
if (facMin == 0) {
autoDistMin = 0;
- autoDistMax = tmax(-2.0, facMax * (p0.thick + p1.thick) * (p0.thick + p1.thick));
+ autoDistMax = std::max(-2.0, facMax * (p0.thick + p1.thick) * (p0.thick + p1.thick));
if (autoDistMax < 0.0000001) //! for strokes without thickness, I connect for distances less than min between 2.5 and half of the length of the stroke)
{
double len1 = s1->getLength();
double len2 = s2->getLength();
- autoDistMax = facMax * tmin(2.5, len1 * len1 / (2 * 2), len2 * len2 / (2 * 2), 100.0 /*dummyVal*/);
+ autoDistMax = facMax * std::min({2.5, len1 * len1 / (2 * 2), len2 * len2 / (2 * 2), 100.0 /*dummyVal*/});
}
} else {
- autoDistMin = tmax(-2.0, facMin * (p0.thick + p1.thick) * (p0.thick + p1.thick));
+ autoDistMin = std::max(-2.0, facMin * (p0.thick + p1.thick) * (p0.thick + p1.thick));
if (autoDistMin < 0.0000001) //! for strokes without thickness, I connect for distances less than min between 2.5 and half of the length of the stroke)
{
double len1 = s1->getLength();
double len2 = s2->getLength();
- autoDistMin = facMax * tmin(2.5, len1 * len1 / (2 * 2), len2 * len2 / (2 * 2), 100.0 /*dummyVal*/);
+ autoDistMin = facMax * std::min({2.5, len1 * len1 / (2 * 2), len2 * len2 / (2 * 2), 100.0 /*dummyVal*/});
}
autoDistMax = autoDistMin + (facMax - facMin) * (facMax - facMin);
@@ -1479,7 +1479,7 @@ bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, TStr
if (dist2 < autoDistMin || dist2 > autoDistMax)
return false;
- //if (dist2<=tmax(2.0, g_autocloseTolerance*(p0.thick+p1.thick)*(p0.thick+p1.thick))) //0.01 tiene conto di quando thick==0
+ //if (dist2<=std::max(2.0, g_autocloseTolerance*(p0.thick+p1.thick)*(p0.thick+p1.thick))) //0.01 tiene conto di quando thick==0
if (s1 == s2) {
TRectD r = s1->getBBox(); //se e' un autoclose su una stroke piccolissima, creerebbe uan area trascurabile, ignoro
if (fabs(r.x1 - r.x0) < 2 && fabs(r.y1 - r.y0) < 2)
@@ -1542,7 +1542,7 @@ double getCurlW(TStroke *s, bool isBegin) //trova il punto di split su una strok
int maxMin1 = isBegin ? j : numChunks - 1 - j;
- return getWfromChunkAndT(s, isBegin ? tmax(maxMin0, maxMin1) : tmin(maxMin0, maxMin1), isBegin ? 1.0 : 0.0);
+ return getWfromChunkAndT(s, isBegin ? std::max(maxMin0, maxMin1) : std::min(maxMin0, maxMin1), isBegin ? 1.0 : 0.0);
}
#ifdef Levo
@@ -1590,7 +1590,7 @@ bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, TStr
if (w == -1)
return false;
- split<TStroke>(*s1, tmin(1 - w1, w), tmax(1 - w1, w), sAux);
+ split<TStroke>(*s1, std::min(1 - w1, w), std::max(1 - w1, w), sAux);
sComp = &sAux;
} else
sComp = s2;
@@ -1618,30 +1618,30 @@ bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, TStr
double autoDistMin, autoDistMax;
if (facMin == 0) {
autoDistMin = 0;
- autoDistMax = tmax(-2.0, (facMax + 0.7) * (p0.thick + p1.thick) * (p0.thick + p1.thick));
+ autoDistMax = std::max(-2.0, (facMax + 0.7) * (p0.thick + p1.thick) * (p0.thick + p1.thick));
if (autoDistMax < 0.0000001) //! for strokes without thickness, I connect for distances less than min between 2.5 and half of the length of the pointing stroke)
{
double len1 = s1->getLength();
- autoDistMax = facMax * tmin(2.5, len1 * len1 / (2 * 2));
+ autoDistMax = facMax * std::min(2.5, len1 * len1 / (2 * 2));
}
} else {
- autoDistMin = tmax(-2.0, (facMin + 0.7) * (p0.thick + p1.thick) * (p0.thick + p1.thick));
+ autoDistMin = std::max(-2.0, (facMin + 0.7) * (p0.thick + p1.thick) * (p0.thick + p1.thick));
if (autoDistMin < 0.0000001) //! for strokes without thickness, I connect for distances less than min between 2.5 and half of the length of the pointing stroke)
{
double len1 = s1->getLength();
- autoDistMin = facMax * tmin(2.5, len1 * len1 / (2 * 2));
+ autoDistMin = facMax * std::min(2.5, len1 * len1 / (2 * 2));
}
autoDistMax = autoDistMin + (facMax - facMin + 0.7) * (facMax - facMin + 0.7);
}
- //double autoDistMin = tmax(-2.0, facMin==0?0:(facMin+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick));
- //double autoDistMax = tmax(-2.0, (facMax+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick));
+ //double autoDistMin = std::max(-2.0, facMin==0?0:(facMin+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick));
+ //double autoDistMax = std::max(-2.0, (facMax+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick));
if (dist2 < autoDistMin || dist2 > autoDistMax)
return false;
- //if (dist2<=(tmax(2.0, (g_autocloseTolerance+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick)))) //0.01 tiene conto di quando thick==0
+ //if (dist2<=(std::max(2.0, (g_autocloseTolerance+0.7)*(p0.thick+p1.thick)*(p0.thick+p1.thick)))) //0.01 tiene conto di quando thick==0
w = getWfromChunkAndT(s2, index, t);
return true;
@@ -2465,8 +2465,8 @@ for (UINT i=0; i<r1.getEdgeCount(); i++)
{
TEdge *e2 = r2.getEdge(j);
if (e1->m_s==e2->m_s &&
- tmin(e1->m_w0, e1->m_w1)==tmin(e2->m_w0, e2->m_w1) &&
- tmax(e1->m_w0, e1->m_w1)==tmax(e2->m_w0, e2->m_w1))
+ std::min(e1->m_w0, e1->m_w1)==std::min(e2->m_w0, e2->m_w1) &&
+ std::max(e1->m_w0, e1->m_w1)==std::max(e2->m_w0, e2->m_w1))
{
if (e1->m_styleId && !e2->m_styleId)
e2->m_styleId=e1->m_styleId;
@@ -3363,8 +3363,8 @@ TStroke *TVectorImage::Imp::removeEndpoints(int strokeIndex)
double minW = 1.0;
double maxW = 0.0;
for (; it != vs->m_edgeList.end(); ++it) {
- minW = tmin(minW - 0.00002, (*it)->m_w0, (*it)->m_w1);
- maxW = tmax(maxW + 0.00002, (*it)->m_w0, (*it)->m_w1);
+ minW = std::min({minW - 0.00002, (*it)->m_w0, (*it)->m_w1});
+ maxW = std::max({maxW + 0.00002, (*it)->m_w0, (*it)->m_w1});
}
if (areAlmostEqual(minW, 0.0, 0.001) && areAlmostEqual(maxW, 1.0, 0.001))
diff --git a/toonz/sources/common/tvectorimage/tl2lautocloser.cpp b/toonz/sources/common/tvectorimage/tl2lautocloser.cpp
index 4c285c607..6e57688c5 100644
--- a/toonz/sources/common/tvectorimage/tl2lautocloser.cpp
+++ b/toonz/sources/common/tvectorimage/tl2lautocloser.cpp
@@ -58,8 +58,8 @@ namespace
TPointD getCurvature(TStroke *stroke, double w)
{
const double h = 0.0001;
- double w0 = tmax(0.0, w - h);
- double w1 = tmin(1.0, w + h);
+ double w0 = std::max(0.0, w - h);
+ double w1 = std::min(1.0, w + h);
TPointD p0 = stroke->getPoint(w0);
TPointD p1 = stroke->getPoint(w1);
double ds = norm(p0 - p1);
@@ -270,7 +270,7 @@ void StrokesIntersection::computeIntersectionDistances(
if (is[k] > s)
d = is[k] - s;
else if (k + 1 < isn)
- d = tmin(is[k + 1] - s, s - is[k]);
+ d = std::min(is[k + 1] - s, s - is[k]);
else
d = s - is[k];
}
diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp
index 0f1d2c893..9ed0a5c0f 100644
--- a/toonz/sources/common/tvectorimage/tregion.cpp
+++ b/toonz/sources/common/tvectorimage/tregion.cpp
@@ -88,8 +88,8 @@ public:
m_bBox = TRectD();
for (UINT i = 0; i < m_edge.size(); i++)
- m_bBox += m_edge[i]->m_s->getBBox(tmin(m_edge[i]->m_w0, m_edge[i]->m_w1),
- tmax(m_edge[i]->m_w0, m_edge[i]->m_w1));
+ m_bBox += m_edge[i]->m_s->getBBox(std::min(m_edge[i]->m_w0, m_edge[i]->m_w1),
+ std::max(m_edge[i]->m_w0, m_edge[i]->m_w1));
m_isValidBBox = true;
}
@@ -696,7 +696,7 @@ bool TRegion::Imp::contains(const TPointD &p) const
else
p1 = m_edge[0]->m_s->getPoint(m_edge[0]->m_w0);
- if (tmin(p0.y, p1.y) > p.y || tmax(p0.y, p1.y) < p.y)
+ if (std::min(p0.y, p1.y) > p.y || std::max(p0.y, p1.y) < p.y)
continue;
if (!areAlmostEqual(p0, p1, 1e-2))
@@ -1070,10 +1070,10 @@ for (i=0; i<m_edge.size(); i++)
for (j=0, found=false; !found && j<r.m_edge.size(); j++)
if (m_edge[i]->m_s==r.m_edge[j]->m_s)
{
- double w0 = tmin(m_edge[i]->m_w0, m_edge[i]->m_w1) ;
- double w1 = tmax(m_edge[i]->m_w0, m_edge[i]->m_w1) ;
- double r_w0 = tmin(r.m_edge[j]->m_w0, r.m_edge[j]->m_w1);
- double r_w1 = tmax(r.m_edge[j]->m_w0, r.m_edge[j]->m_w1);
+ double w0 = std::min(m_edge[i]->m_w0, m_edge[i]->m_w1) ;
+ double w1 = std::max(m_edge[i]->m_w0, m_edge[i]->m_w1) ;
+ double r_w0 = std::min(r.m_edge[j]->m_w0, r.m_edge[j]->m_w1);
+ double r_w1 = std::max(r.m_edge[j]->m_w0, r.m_edge[j]->m_w1);
if ((w0>=r_w0 || areAlmostEqual(w0, r_w0, 0.1)) &&
(w1<=r_w1 || areAlmostEqual(w1, r_w1, 0.1)))
diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp
index 9e306f95e..0b70afc63 100644
--- a/toonz/sources/common/tvectorimage/tstroke.cpp
+++ b/toonz/sources/common/tvectorimage/tstroke.cpp
@@ -147,10 +147,10 @@ void analyzeSolution(const vector<double> &coeff, vector<DoublePair> &interval)
if (coeff[1] > 0) {
if (singleSol < 1)
- interval.push_back(DoublePair(tmax(0.0, singleSol), 1.0));
+ interval.push_back(DoublePair(std::max(0.0, singleSol), 1.0));
} else {
if (singleSol > 0)
- interval.push_back(DoublePair(0.0, tmin(1.0, singleSol)));
+ interval.push_back(DoublePair(0.0, std::min(1.0, singleSol)));
}
return;
}
@@ -171,13 +171,13 @@ void analyzeSolution(const vector<double> &coeff, vector<DoublePair> &interval)
break;
case 2:
- interval.push_back(DoublePair(0.0, tmin(tmax(sol[0], 0.0), 1.0)));
- interval.push_back(DoublePair(tmax(tmin(sol[1], 1.0), 0.0), 1.0));
+ interval.push_back(DoublePair(0.0, std::min(std::max(sol[0], 0.0), 1.0)));
+ interval.push_back(DoublePair(std::max(std::min(sol[1], 1.0), 0.0), 1.0));
break;
}
} else if (coeff[2] < 0 && sol.size() == 2)
- interval.push_back(DoublePair(tmin(tmax(sol[0], 0.0), 1.0),
- tmax(tmin(sol[1], 1.0), 0.0)));
+ interval.push_back(DoublePair(std::min(std::max(sol[0], 0.0), 1.0),
+ std::max(std::min(sol[1], 1.0), 0.0)));
// eat not valid interval
std::vector<DoublePair>::iterator it = std::remove_if(interval.begin(),
@@ -366,7 +366,7 @@ inline void changeTQDirection(TThickQuadratic *tq)
double dist23 = tdistance2(p, rect.getP10());
double dist24 = tdistance2(p, rect.getP11());
- if (tmin(dist21, dist22, dist23, dist24)>=maxDistance2)
+ if (std::min(dist21, dist22, dist23, dist24)>=maxDistance2)
return maxDistance2;
}
currT = tq.getT(p);
@@ -871,7 +871,7 @@ void TStroke::Imp::computeMaxThickness()
{
m_maxThickness = m_centerLineArray[0]->getThickP0().thick;
for (UINT i = 0; i < m_centerLineArray.size(); i++)
- m_maxThickness = tmax(m_maxThickness, m_centerLineArray[i]->getThickP1().thick, m_centerLineArray[i]->getThickP2().thick);
+ m_maxThickness = std::max({m_maxThickness, m_centerLineArray[i]->getThickP1().thick, m_centerLineArray[i]->getThickP2().thick});
}
void TStroke::Imp::computeCacheVector()
@@ -2057,7 +2057,7 @@ void TStroke::enableComputeOfCaches()
//DEL double dist23 = tdistance2(p, rect.getP10());
//DEL double dist24 = tdistance2(p, rect.getP11());
//DEL
-//DEL if (tmin(dist21, dist22, dist23, dist24)>=maxDistance2)
+//DEL if (std::min(dist21, dist22, dist23, dist24)>=maxDistance2)
//DEL return maxDistance2;
//DEL }
//DEL
diff --git a/toonz/sources/common/tvectorimage/tsweepboundary.cpp b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
index cb963282a..df43486e0 100644
--- a/toonz/sources/common/tvectorimage/tsweepboundary.cpp
+++ b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
@@ -490,16 +490,18 @@ inline void computeStrokeBoundary(const TStroke &stroke, LinkedQuadraticList &in
thickQuadratic = stroke.getChunk(chunkIndex);
while (thickQuadratic->getP0() == thickQuadratic->getP2()) {
double thickness;
- thickness = tmax(thickQuadratic->getThickP0().thick,
- thickQuadratic->getThickP1().thick,
- thickQuadratic->getThickP2().thick);
+ thickness = std::max({
+ thickQuadratic->getThickP0().thick,
+ thickQuadratic->getThickP1().thick,
+ thickQuadratic->getThickP2().thick});
++chunkIndex;
if (chunkIndex == chunkCount) {
vector<TQuadratic *> quadArray;
- double thickness = tmax(thickQuadratic->getThickP0().thick,
- thickQuadratic->getThickP1().thick,
- thickQuadratic->getThickP2().thick);
+ double thickness = std::max({
+ thickQuadratic->getThickP0().thick,
+ thickQuadratic->getThickP1().thick,
+ thickQuadratic->getThickP2().thick});
if (thickness < thicknessLimit)
thickness = thicknessLimit;
diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp
index b51aaaad6..cc327c77a 100644
--- a/toonz/sources/common/tvectorimage/tvectorimage.cpp
+++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp
@@ -602,7 +602,7 @@ TRectD TVectorImage::getBBox() const
if (dynamic_cast<TRasterImagePatternStrokeStyle *>(style) ||
dynamic_cast<TVectorImagePatternStrokeStyle *>(style)) //con i pattern style, il render a volte taglia sulla bbox dello stroke....
//aumento la bbox della meta' delle sue dimensioni:pezzaccia.
- r = r.enlarge(tmax(r.getLx() * 0.25, r.getLy() * 0.25));
+ r = r.enlarge(std::max(r.getLx() * 0.25, r.getLy() * 0.25));
bbox = ((i == 0) ? r : bbox + r);
}
@@ -1026,13 +1026,13 @@ list<TEdge*>::const_iterator it1;
if (isStrokeChanged) {
double totLenght1 = (*it1)->m_s->getLength();
- _l0 = (*it1)->m_s->getLength(tmin((*it1)->m_w0, (*it1)->m_w1)) / totLenght1;
- _l1 = (*it1)->m_s->getLength(tmax((*it1)->m_w0, (*it1)->m_w1)) / totLenght1;
+ _l0 = (*it1)->m_s->getLength(std::min((*it1)->m_w0, (*it1)->m_w1)) / totLenght1;
+ _l1 = (*it1)->m_s->getLength(std::max((*it1)->m_w0, (*it1)->m_w1)) / totLenght1;
} else {
- _l0 = tmin((*it1)->m_w0, (*it1)->m_w1);
- _l1 = tmax((*it1)->m_w0, (*it1)->m_w1);
+ _l0 = std::min((*it1)->m_w0, (*it1)->m_w1);
+ _l1 = std::max((*it1)->m_w0, (*it1)->m_w1);
}
- double delta = tmin(l1, _l1) - tmax(l0, _l0);
+ double delta = std::min(l1, _l1) - std::max(l0, _l0);
if (delta > deltaMax) {
deltaMax = delta;
newStyle = (*it1)->m_styleId;
@@ -1395,12 +1395,12 @@ void TVectorImage::Imp::reindexGroups(TVectorImage::Imp &img)
if (s->m_groupId.m_id[0] > 0)
for (j = 0; j < s->m_groupId.m_id.size(); j++) {
s->m_groupId.m_id[j] += img.m_maxGroupId;
- newMax = tmax(newMax, s->m_groupId.m_id[j]);
+ newMax = std::max(newMax, s->m_groupId.m_id[j]);
}
else
for (j = 0; j < s->m_groupId.m_id.size(); j++) {
s->m_groupId.m_id[j] -= img.m_maxGhostGroupId;
- newMaxGhost = tmax(newMaxGhost, -s->m_groupId.m_id[j]);
+ newMaxGhost = std::max(newMaxGhost, -s->m_groupId.m_id[j]);
}
}
m_maxGroupId = img.m_maxGroupId = newMax;
@@ -1881,8 +1881,8 @@ if (vs->m_s->isSelfLoop())
std::list<TEdge *>::const_iterator it = origEdgeList.begin(), it_e = origEdgeList.end();
for (; it != it_e; ++it) {
- double wMin = tmin((*it)->m_w0, (*it)->m_w1);
- double wMax = tmax((*it)->m_w0, (*it)->m_w1);
+ double wMin = std::min((*it)->m_w0, (*it)->m_w1);
+ double wMax = std::max((*it)->m_w0, (*it)->m_w1);
if (wMin >= sortedWRanges[i].second || wMax <= sortedWRanges[i].first)
continue;
@@ -2713,7 +2713,7 @@ int TGroupId::getCommonParentDepth(const TGroupId &id) const
int size2 = id.m_id.size();
int count;
- for (count = 0; count < tmin(size1, size2); count++)
+ for (count = 0; count < std::min(size1, size2); count++)
if (m_id[size1 - count - 1] != id.m_id[size2 - count - 1])
break;
@@ -2784,7 +2784,7 @@ bool TGroupId::operator<(const TGroupId &id) const
int size1 = m_id.size();
int size2 = id.m_id.size();
int i;
- for (i = 0; i < tmin(size1, size2); i++)
+ for (i = 0; i < std::min(size1, size2); i++)
if (m_id[size1 - i - 1] != id.m_id[size2 - i - 1])
return m_id[size1 - i - 1] < id.m_id[size2 - i - 1];
diff --git a/toonz/sources/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp
index 860e4c295..e1484d9c8 100644
--- a/toonz/sources/common/tvrender/qtofflinegl.cpp
+++ b/toonz/sources/common/tvrender/qtofflinegl.cpp
@@ -304,7 +304,7 @@ void QtOfflineGLPBuffer::createContext(TDimension rasterSize)
// Il PixelBuffer deve essere con width ed height potenze di 2
- int sizeMax = tmax(rasterSize.lx, rasterSize.ly);
+ int sizeMax = std::max(rasterSize.lx, rasterSize.ly);
// trovo la potenza di 2 che "contiene" sizeMax e la utilizzo per il PBuffer
int pBufferSize = 2;
diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp
index b592e3c2a..fc663be89 100644
--- a/toonz/sources/common/tvrender/tcolorstyles.cpp
+++ b/toonz/sources/common/tvrender/tcolorstyles.cpp
@@ -298,7 +298,7 @@ void TColorStyle::makeIcon(const TDimension &d)
double scx = 0.9 * d.lx / bbox.getLx();
double scy = 0.9 * d.ly / bbox.getLy();
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
double dx = (d.lx - bbox.getLx() * sc) * 0.5;
double dy = (d.ly - bbox.getLy() * sc) * 0.5;
TAffine aff = TScale(scx, scy) * TTranslation(-bbox.getP00() + TPointD(dx, dy));
diff --git a/toonz/sources/common/tvrender/tellipticbrush.cpp b/toonz/sources/common/tvrender/tellipticbrush.cpp
index 472fc8b9d..7b6f7dfa7 100644
--- a/toonz/sources/common/tvrender/tellipticbrush.cpp
+++ b/toonz/sources/common/tvrender/tellipticbrush.cpp
@@ -430,7 +430,7 @@ void RecursiveLinearizator::subdivide(std::vector<CenterlinePoint> &cPoints,
buildEnvelopeDirections(cp1.m_p, cp1.m_prevD, envDirL1, envDirR1);
TPointD diff(convert(cp1.m_p) - convert(cp0.m_p));
- double d = tmax(
+ double d = std::max(
fabs(envDirL0 * (diff + cp1.m_p.thick * envDirL1 - cp0.m_p.thick * envDirL0)),
fabs(envDirR0 * (diff + cp1.m_p.thick * envDirR1 - cp0.m_p.thick * envDirR0)));
@@ -917,7 +917,7 @@ void tellipticbrush::OutlineBuilder::addRoundSideCaps(
buildAngularSubdivision(cPoint.m_p.thick, totAngleL, m_pixSize, nAnglesL);
buildAngularSubdivision(cPoint.m_p.thick, totAngleR, m_pixSize, nAnglesR);
- int nAngles = tmax(nAnglesL, nAnglesR);
+ int nAngles = std::max(nAnglesL, nAnglesR);
double stepAngleL = totAngleL / (double)nAngles;
double stepAngleR = totAngleR / (double)nAngles;
@@ -1012,7 +1012,7 @@ void tellipticbrush::OutlineBuilder::addMiterSideCaps(
TPointD p1(convert(cPoint.m_p) + envNextSide);
//Set coordinates bounds
- double lowerBound = tmax(cPoint.m_p.thick * m_oOptions.m_miterLower, m_pixSize);
+ double lowerBound = std::max(cPoint.m_p.thick * m_oOptions.m_miterLower, m_pixSize);
double upperBound = cPoint.m_p.thick * m_oOptions.m_miterUpper;
//Build the intersection between the 2 lines
diff --git a/toonz/sources/common/tvrender/tellipticbrushP.h b/toonz/sources/common/tvrender/tellipticbrushP.h
index 4503bf938..66f9cbf74 100644
--- a/toonz/sources/common/tvrender/tellipticbrushP.h
+++ b/toonz/sources/common/tvrender/tellipticbrushP.h
@@ -250,10 +250,10 @@ inline void OutlineBuilder::addEnvelopePoint(TRectD &bbox, const TPointD &oPoint
template <>
inline void OutlineBuilder::addExtensionPoint(TRectD &bbox, const TPointD &oPoint, int countIdx)
{
- bbox.x0 = tmin(bbox.x0, oPoint.x);
- bbox.y0 = tmin(bbox.y0, oPoint.y);
- bbox.x1 = tmax(bbox.x1, oPoint.x);
- bbox.y1 = tmax(bbox.y1, oPoint.y);
+ bbox.x0 = std::min(bbox.x0, oPoint.x);
+ bbox.y0 = std::min(bbox.y0, oPoint.y);
+ bbox.x1 = std::max(bbox.x1, oPoint.x);
+ bbox.y1 = std::max(bbox.y1, oPoint.y);
}
template <>
diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cpp
index ab230241e..c91c5c105 100644
--- a/toonz/sources/common/tvrender/tpalette.cpp
+++ b/toonz/sources/common/tvrender/tpalette.cpp
@@ -445,8 +445,8 @@ bool TPalette::getFxRects(const TRect &rect, TRect &rectIn, TRect &rectOut)
for (i = 0; i < (int)m_styles.size(); i++)
if (m_styles[i].second->isRasterStyle()) {
m_styles[i].second->getRasterStyleFx()->getEnlargement(borderIn, borderOut);
- fullBorderIn = tmax(fullBorderIn, borderIn);
- fullBorderOut = tmax(fullBorderOut, borderOut);
+ fullBorderIn = std::max(fullBorderIn, borderIn);
+ fullBorderOut = std::max(fullBorderOut, borderOut);
ret = true;
}
diff --git a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
index f5731df0a..1f1036d2d 100644
--- a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
+++ b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp
@@ -844,7 +844,7 @@ void TRasterImagePatternStrokeStyle::makeIcon(const TDimension &size)
icon->fill(TPixel32::White);
double sx = (double)icon->getLx() / (double)src->getLx();
double sy = (double)icon->getLy() / (double)src->getLy();
- double sc = 0.8 * tmin(sx, sy);
+ double sc = 0.8 * std::min(sx, sy);
TRop::resample(icon, src, TScale(sc).place(src->getCenterD(), icon->getCenterD()));
TRop::addBackground(icon, TPixel32::White);
m_icon = icon;
@@ -942,7 +942,7 @@ void TRasterImagePatternStrokeStyle::loadLevel(const std::string &patternName)
{
double scx = 1 * dstSize.lx / (double)srcSize.lx;
double scy = 1 * dstSize.ly / (double)srcSize.ly;
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
double dx = (dstSize.lx - srcSize.lx * sc) * 0.5;
double dy = (dstSize.ly - srcSize.ly * sc) * 0.5;
return TScale(sc) * TTranslation(0.5 * TPointD(srcSize.lx, srcSize.ly) + TPointD(dx, dy));
@@ -1058,10 +1058,10 @@ void TRasterImagePatternStrokeStyle::computeTransformations(std::vector<TAffine>
TPointD v = stroke->getSpeed(t);
double ang = rad2degree(atan(v)) + m_rotation;
- int ly = tmax(1.0, images[index].ly);
+ int ly = std::max(1.0, images[index].ly);
double sc = p.thick / ly;
transformations.push_back(TTranslation(p) * TRotation(ang) * TScale(sc));
- double ds = tmax(2.0, sc * images[index].lx * 2 + m_space);
+ double ds = std::max(2.0, sc * images[index].lx * 2 + m_space);
s += ds;
}
}
@@ -1319,7 +1319,7 @@ void TVectorImagePatternStrokeStyle::makeIcon(const TDimension &size)
TRectD bbox = img->getBBox();
double scx = 0.8 * size.lx / bbox.getLx();
double scy = 0.8 * size.ly / bbox.getLy();
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
double dx = (size.lx - bbox.getLx() * sc) * 0.5;
double dy = (size.ly - bbox.getLy() * sc) * 0.5;
TAffine aff = TScale(sc) * TTranslation(-bbox.getP00() + TPointD(dx, dy));
@@ -1451,7 +1451,7 @@ void TVectorImagePatternStrokeStyle::computeTransformations(std::vector<TAffine>
TAffine aff =
TTranslation(p) * TRotation(ang) * TScale(sc) * TTranslation(-center);
transformations.push_back(aff);
- double ds = tmax(2.0, sc * bbox.getLx() + m_space);
+ double ds = std::max(2.0, sc * bbox.getLx() + m_space);
s += ds;
}
}
@@ -1689,7 +1689,7 @@ void TVectorImagePatternStrokeStyle::drawStroke(TFlash &flash, const TStroke *st
//flash.draw(imgPointer, 0);
flash.popMatrix();
- double ds = tmax(2.0, sc * bbox.getLx() + m_space);
+ double ds = std::max(2.0, sc * bbox.getLx() + m_space);
s += ds;
}
}
diff --git a/toonz/sources/common/tvrender/tstrokeutil.cpp b/toonz/sources/common/tvrender/tstrokeutil.cpp
index ef3bbf41f..2465dde07 100644
--- a/toonz/sources/common/tvrender/tstrokeutil.cpp
+++ b/toonz/sources/common/tvrender/tstrokeutil.cpp
@@ -435,7 +435,7 @@ void transform_thickness(TStroke &stroke, const double poly[], int deg)
int cp, cpCount = stroke.getControlPointCount();
for (cp = 0; cp != cpCount; ++cp) {
TThickPoint cpPoint = stroke.getControlPoint(cp);
- cpPoint.thick = tmax(
+ cpPoint.thick = std::max(
tcg::poly_ops::evaluate(poly, deg, cpPoint.thick),
0.0);
diff --git a/toonz/sources/common/tvrender/tvectorbrush.cpp b/toonz/sources/common/tvrender/tvectorbrush.cpp
index 93b3a6b7c..5e67e942f 100644
--- a/toonz/sources/common/tvrender/tvectorbrush.cpp
+++ b/toonz/sources/common/tvrender/tvectorbrush.cpp
@@ -78,12 +78,12 @@ void getHRange(const TThickQuadratic &ttq, double &x0, double &x1)
const TPointD &P2 = ttq.getP2();
//Get the horizontal range of the chunk
- x0 = tmin(x0, P0.x, P2.x), x1 = tmax(x1, P0.x, P2.x);
+ x0 = std::min({x0, P0.x, P2.x}), x1 = std::max({x1, P0.x, P2.x});
double t = (P0.x - P1.x) / (P0.x + P2.x - 2.0 * P1.x);
if (t > 0.0 && t < 1.0) {
double x = getX(P0, P1, P2, t);
- x0 = tmin(x0, x), x1 = tmax(x1, x);
+ x0 = std::min(x0, x), x1 = std::max(x1, x);
}
}
@@ -97,12 +97,12 @@ void getHRange(const TThickQuadratic &ttq, double t0, double t1, double &x0, dou
double x1_ = getX(P0, P1, P2, t1);
//Get the horizontal range of the chunk
- x0 = tmin(x0, x0_, x1_), x1 = tmax(x1, x0_, x1_);
+ x0 = std::min({x0, x0_, x1_}), x1 = std::max({x1, x0_, x1_});
double t = (P0.x - P1.x) / (P0.x + P2.x - 2.0 * P1.x);
if (t > t0 && t < t1) {
double x = getX(P0, P1, P2, t);
- x0 = tmin(x0, x), x1 = tmax(x1, x);
+ x0 = std::min(x0, x), x1 = std::max(x1, x);
}
}
@@ -296,7 +296,7 @@ int StrokeOutlinizationData::buildPoints(const CenterlinePoint &p, CenterlinePoi
}
}
- return tmax(prevIdx, nextIdx) + 1;
+ return std::max(prevIdx, nextIdx) + 1;
}
//--------------------------------------------------------------------------------------------
@@ -446,7 +446,7 @@ void ReferenceChunksLinearizator::addCenterlinePoints(std::vector<CenterlinePoin
int i, initialSize = cPoints.size();
for (i = chunk0; i < chunk1; ++i) {
#ifdef USE_LENGTH
- double s = tmin(path.getLength(i, 1.0) / path.getLength(), 1.0);
+ double s = std::min(path.getLength(i, 1.0) / path.getLength(), 1.0);
double x = m_data.m_x0 + m_data.m_xRange * s;
#else
double w = path.getW(i, 1.0);
@@ -602,7 +602,7 @@ void RecursiveReferenceLinearizator::subdivide(
buildEnvelopeDirections(cp1.m_p, cp1.m_prevD, envDirL1, envDirR1);
TPointD diff(convert(cp1.m_p) - convert(cp0.m_p));
- double d = tmax(
+ double d = std::max(
fabs(envDirL0 * (diff + cp1.m_p.thick * envDirL1 - cp0.m_p.thick * envDirL0)),
fabs(envDirR0 * (diff + cp1.m_p.thick * envDirR1 - cp0.m_p.thick * envDirR0)));
diff --git a/toonz/sources/common/twain/ttwain_state.c b/toonz/sources/common/twain/ttwain_state.c
index c751fd129..b365266ff 100644
--- a/toonz/sources/common/twain/ttwain_state.c
+++ b/toonz/sources/common/twain/ttwain_state.c
@@ -37,7 +37,13 @@ static void TTWAIN_FreeVar(void);
#define COMPANY "Digital Video"
#define PRODUCT "TOONZ"
-#define MIN(A, B) (((A) < (B)) ? (A) : (B))
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
#define CEIL(x) ((int)(x) < (x) ? (int)(x) + 1 : (int)(x))
#define PRINTF
@@ -959,7 +965,7 @@ static int TTWAIN_MemoryXferHandler(void)
extraX = info.ImageWidth - TTwainData.transferInfo.preferredLx;
extraY = info.ImageLength - TTwainData.transferInfo.preferredLy;
- rowsRemaining = MIN(TTwainData.transferInfo.preferredLy, info.ImageLength);
+ rowsRemaining = min(TTwainData.transferInfo.preferredLy, info.ImageLength);
targetBuffer = TTwainData.transferInfo.memoryBuffer;
@@ -987,8 +993,8 @@ memset(targetBuffer, 0xff, TTwainData.transferInfo.memorySize);
PRINTF("IMAGEMEMXFER, GET, returns SUCCESS\n");
if (imgInfoOk) {
TW_UINT32 colsToCopy;
- rowsToCopy = MIN(imageMemXfer->Rows, rowsRemaining);
- colsToCopy = MIN(imageMemXfer->Columns, (unsigned long)TTwainData.transferInfo.preferredLx);
+ rowsToCopy = min(imageMemXfer->Rows, rowsRemaining);
+ colsToCopy = min(imageMemXfer->Columns, (unsigned long)TTwainData.transferInfo.preferredLx);
bytesToCopy = CEIL(colsToCopy * pixSize);
bytesToWrap = CEIL(TTwainData.transferInfo.preferredLx * pixSize);
} else {
@@ -1024,8 +1030,8 @@ memset(targetBuffer, 0xff, TTwainData.transferInfo.memorySize);
/*copy the last transfer data*/
if (imgInfoOk) {
TW_UINT32 colsToCopy;
- rowsToCopy = MIN(imageMemXfer->Rows, rowsRemaining);
- colsToCopy = MIN(imageMemXfer->Columns, (unsigned long)TTwainData.transferInfo.preferredLx);
+ rowsToCopy = min(imageMemXfer->Rows, rowsRemaining);
+ colsToCopy = min(imageMemXfer->Columns, (unsigned long)TTwainData.transferInfo.preferredLx);
bytesToCopy = CEIL(colsToCopy * pixSize);
bytesToWrap = CEIL(TTwainData.transferInfo.preferredLx * pixSize);
} else {
diff --git a/toonz/sources/image/compatibility/inforegion.c b/toonz/sources/image/compatibility/inforegion.c
index 189b89c71..4742ff663 100644
--- a/toonz/sources/image/compatibility/inforegion.c
+++ b/toonz/sources/image/compatibility/inforegion.c
@@ -1,10 +1,15 @@
-
-
#include <stdio.h>
#include "inforegion.h"
#include "tnz4.h"
/*---------------------------------------------------------------------------*/
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
void getInfoRegion(
INFO_REGION *region,
int x1_out, int y1_out, int x2_out, int y2_out, int scale,
@@ -244,8 +249,8 @@ int get_info_region(EXT_INFO_REGION *region,
}
}
- appoNcol = MIN((region->scanNcol * scale), width_in);
- appoNrow = MIN((region->scanNrow * scale), height_in);
+ appoNcol = min((region->scanNcol * scale), width_in);
+ appoNrow = min((region->scanNrow * scale), height_in);
switch (orientation) {
case TNZ_TOPLEFT:
@@ -255,7 +260,7 @@ int get_info_region(EXT_INFO_REGION *region,
region->verso_y = -1;
region->sxpix = region->startScanCol;
region->sypix = height_in - region->startScanRow - appoNrow;
- region->sypix = MAX(0, region->sypix);
+ region->sypix = max(0, region->sypix);
break;
case TNZ_TOPRIGHT:
region->buf_inc = -1;
@@ -265,8 +270,8 @@ int get_info_region(EXT_INFO_REGION *region,
region->verso_y = -1;
region->sxpix = width_in - region->startScanCol - appoNcol;
region->sypix = height_in - region->startScanRow - appoNrow;
- region->sxpix = MAX(0, region->sxpix);
- region->sypix = MAX(0, region->sypix);
+ region->sxpix = max(0, region->sxpix);
+ region->sypix = max(0, region->sypix);
break;
case TNZ_BOTRIGHT:
region->buf_inc = -1;
diff --git a/toonz/sources/image/compatibility/tnz4.h b/toonz/sources/image/compatibility/tnz4.h
index 21e978f1f..0704d2b55 100644
--- a/toonz/sources/image/compatibility/tnz4.h
+++ b/toonz/sources/image/compatibility/tnz4.h
@@ -93,9 +93,6 @@ typedef struct IMAGE {
} \
}
-#define MAX(A, B) ((A) > (B) ? (A) : (B))
-#define MIN(A, B) ((A) < (B) ? (A) : (B))
-
#define NOT_LESS_THAN(MIN, X) \
{ \
if ((X) < (MIN)) \
diff --git a/toonz/sources/image/mov/tiio_movW.cpp b/toonz/sources/image/mov/tiio_movW.cpp
index b2a1e7658..d21815e84 100644
--- a/toonz/sources/image/mov/tiio_movW.cpp
+++ b/toonz/sources/image/mov/tiio_movW.cpp
@@ -435,7 +435,7 @@ void TImageWriterMov::save(const TImageP &img)
void TLevelWriterMov::save(const TImageP &img, int frameIndex)
{
- m_firstFrame = tmin(frameIndex, m_firstFrame);
+ m_firstFrame = std::min(frameIndex, m_firstFrame);
TRasterImageP image(img);
if (!image)
diff --git a/toonz/sources/image/pli/tiio_pli.cpp b/toonz/sources/image/pli/tiio_pli.cpp
index 83e2abf14..32e7c7306 100644
--- a/toonz/sources/image/pli/tiio_pli.cpp
+++ b/toonz/sources/image/pli/tiio_pli.cpp
@@ -491,10 +491,10 @@ void putStroke(TStroke *stroke, int &currStyleId, std::vector<PliObjectTag *> &t
UINT k;
for (k = 0; k < (UINT)chunkCount; ++k) {
const TThickQuadratic *q = stroke->getChunk(k);
- maxThickness = tmax(maxThickness, q->getThickP0().thick, q->getThickP1().thick);
+ maxThickness = std::max({maxThickness, q->getThickP0().thick, q->getThickP1().thick});
strokeChain[k] = *q;
}
- maxThickness = tmax(maxThickness, stroke->getChunk(chunkCount - 1)->getThickP2().thick);
+ maxThickness = std::max(maxThickness, stroke->getChunk(chunkCount - 1)->getThickP2().thick);
ThickQuadraticChainTag *quadChainTag = new ThickQuadraticChainTag(k, &strokeChain[0], maxThickness);
quadChainTag->m_isLoop = stroke->isSelfLoop();
diff --git a/toonz/sources/image/quantel/filequantel.c b/toonz/sources/image/quantel/filequantel.c
index a85883373..281f8b3b1 100644
--- a/toonz/sources/image/quantel/filequantel.c
+++ b/toonz/sources/image/quantel/filequantel.c
@@ -16,6 +16,13 @@
#include "filequantel.h"
#include "filequantelP.h"
+#ifndef min
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
#ifdef _WIN32
#define STAT_BUF struct _stat
#else
@@ -627,7 +634,7 @@ static IMAGE *img_read_region_quantel_no_interlaced(T_CHAR *fname,
rows_field2 = region.scanNrow / 2;
} else
rows_field1 = rows_field2 = region.scanNrow / 2;
- offset = (region.ly_in - (region.scanNrow * scale + MAX(y1, 0))) / 2;
+ offset = (region.ly_in - (region.scanNrow * scale + max(y1, 0))) / 2;
offset *= BYTESPERROW;
if (fseek(fileyuv, imgoffs + offset, SEEK_SET)) {
@@ -704,7 +711,7 @@ static IMAGE *img_read_region_quantel_no_interlaced(T_CHAR *fname,
}
bufout1 -= region.xsize * 2;
}
- offset = (region.ly_in - (region.scanNrow * scale + MAX(y1, 0))) / 2;
+ offset = (region.ly_in - (region.scanNrow * scale + max(y1, 0))) / 2;
offset = (region.ly_in / 2 + offset);
offset *= BYTESPERROW;
if (fseek(fileyuv, imgoffs + offset, SEEK_SET)) {
diff --git a/toonz/sources/image/tga/tiio_tga.cpp b/toonz/sources/image/tga/tiio_tga.cpp
index 741bace5e..522adc8b7 100644
--- a/toonz/sources/image/tga/tiio_tga.cpp
+++ b/toonz/sources/image/tga/tiio_tga.cpp
@@ -675,7 +675,7 @@ void TgaWriter::writeLine32rle(char *buffer)
while (x < m_info.m_lx) {
if (x + 1 < m_info.m_lx && row[x] == row[x + 1]) {
int count = 2;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] == row[x + count])
count++;
fputc((count - 1) | 0x80, m_chan);
@@ -683,7 +683,7 @@ void TgaWriter::writeLine32rle(char *buffer)
x += count;
} else {
int count = 1;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] != row[x + count])
count++;
fputc(count - 1, m_chan);
@@ -702,7 +702,7 @@ void TgaWriter::writeLine24rle(char *buffer)
while (x < m_info.m_lx) {
if (x + 1 < m_info.m_lx && row[x] == row[x + 1]) {
int count = 2;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] == row[x + count])
count++;
fputc((count - 1) | 0x80, m_chan);
@@ -710,7 +710,7 @@ void TgaWriter::writeLine24rle(char *buffer)
x += count;
} else {
int count = 1;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] != row[x + count])
count++;
fputc(count - 1, m_chan);
@@ -729,7 +729,7 @@ void TgaWriter::writeLine16rle(char *buffer)
while (x < m_info.m_lx) {
if (x + 1 < m_info.m_lx && row[x] == row[x + 1]) {
int count = 2;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] == row[x + count])
count++;
fputc((count - 1) | 0x80, m_chan);
@@ -737,7 +737,7 @@ void TgaWriter::writeLine16rle(char *buffer)
x += count;
} else {
int count = 1;
- int max = tmin(128, m_info.m_lx - x);
+ int max = std::min(128, m_info.m_lx - x);
while (count < max && row[x + count - 1] != row[x + count])
count++;
fputc(count - 1, m_chan);
diff --git a/toonz/sources/image/tif/tiio_tif.cpp b/toonz/sources/image/tif/tiio_tif.cpp
index f095c20e1..33f75d016 100644
--- a/toonz/sources/image/tif/tiio_tif.cpp
+++ b/toonz/sources/image/tif/tiio_tif.cpp
@@ -454,14 +454,14 @@ void TifReader::readLine(short *buffer, int x0, int x1, int shrink)
int y = tileHeight * m_stripIndex;
// In case it's the last tiles row, the tile size might exceed the image bounds
- int lastTy = tmin((int)tileHeight, m_info.m_ly - y);
+ int lastTy = std::min((int)tileHeight, m_info.m_ly - y);
// Traverse the tiles row
while (x < m_info.m_lx) {
int ret = TIFFReadRGBATile_64(m_tiff, x, y, tile.get());
assert(ret);
- int tileRowSize = tmin((int)tileWidth, m_info.m_lx - x) * pixelSize;
+ int tileRowSize = std::min((int)tileWidth, m_info.m_lx - x) * pixelSize;
// Copy the tile rows in the corresponding output strip rows
for (int ty = 0; ty < lastTy; ++ty) {
@@ -496,7 +496,7 @@ void TifReader::readLine(short *buffer, int x0, int x1, int shrink)
// The last tiles row will actually start at the END OF THE IMAGE (not necessarily at
// m_rowsPerStrip multiples). So, we must adjust for that.
- r = tmin(m_rowsPerStrip, m_info.m_ly - m_rowsPerStrip * m_stripIndex) - 1 -
+ r = std::min(m_rowsPerStrip, m_info.m_ly - m_rowsPerStrip * m_stripIndex) - 1 -
(m_row % m_rowsPerStrip);
break;
@@ -583,13 +583,13 @@ void TifReader::readLine(char *buffer, int x0, int x1, int shrink)
int x = 0;
int y = tileHeight * m_stripIndex;
- int lastTy = tmin((int)tileHeight, m_info.m_ly - y);
+ int lastTy = std::min((int)tileHeight, m_info.m_ly - y);
while (x < m_info.m_lx) {
int ret = TIFFReadRGBATile(m_tiff, x, y, tile.get());
assert(ret);
- int tileRowSize = tmin((int)tileWidth, (int)(m_info.m_lx - x)) * pixelSize;
+ int tileRowSize = std::min((int)tileWidth, (int)(m_info.m_lx - x)) * pixelSize;
for (int ty = 0; ty < lastTy; ++ty) {
memcpy(
@@ -623,7 +623,7 @@ void TifReader::readLine(char *buffer, int x0, int x1, int shrink)
// The last tiles row will actually start at the END OF THE IMAGE (not necessarily at
// m_rowsPerStrip multiples). So, we must adjust for that.
- r = tmin(m_rowsPerStrip, m_info.m_ly - m_rowsPerStrip * m_stripIndex) - 1 -
+ r = std::min(m_rowsPerStrip, m_info.m_ly - m_rowsPerStrip * m_stripIndex) - 1 -
(m_row % m_rowsPerStrip);
break;
diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp
index e99330d00..bd2aea3e8 100644
--- a/toonz/sources/image/tzl/tiio_tzl.cpp
+++ b/toonz/sources/image/tzl/tiio_tzl.cpp
@@ -309,7 +309,7 @@ bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, TDi
int lx = imageRes.lx;
int ly = imageRes.ly;
- if (tmax(double(lx) / inDimension.lx, double(ly) / inDimension.ly) == double(ly) / inDimension.ly)
+ if (std::max(double(lx) / inDimension.lx, double(ly) / inDimension.ly) == double(ly) / inDimension.ly)
iconLx = tround((double(lx) * inDimension.ly) / ly);
else
iconLy = tround((double(ly) * inDimension.lx) / lx);
@@ -1173,8 +1173,8 @@ void TLevelWriterTzl::createIcon(const TImageP &imgIn, TImageP &imgOut)
if (tmp_savebox.isEmpty()) {
TINT32 iconsbx0 = tround((double)iconLx * sbx0 / ti->getSize().lx);
TINT32 iconsby0 = tround((double)iconLy * sby0 / ti->getSize().ly);
- TINT32 iconsblx = tmax(tround((double)iconLx * sblx / ti->getSize().lx), 1);
- TINT32 iconsbly = tmax(tround((double)iconLy * sbly / ti->getSize().ly), 1);
+ TINT32 iconsblx = std::max(tround((double)iconLx * sblx / ti->getSize().lx), 1);
+ TINT32 iconsbly = std::max(tround((double)iconLy * sbly / ti->getSize().ly), 1);
savebox = TRect(TPoint(iconsbx0, iconsby0), TDimension(iconsblx, iconsbly));
} else {
savebox = tmp_savebox;
@@ -2173,8 +2173,8 @@ TImageP TImageReaderTzl::load14()
if (tmp_savebox.isEmpty()) {
TINT32 iconsbx0 = tround((double)iconLx * sbx0 / m_lrp->m_res.lx);
TINT32 iconsby0 = tround((double)iconLy * sby0 / m_lrp->m_res.ly);
- TINT32 iconsblx = tmax(tround((double)iconLx * sblx / m_lrp->m_res.lx), 1);
- TINT32 iconsbly = tmax(tround((double)iconLy * sbly / m_lrp->m_res.ly), 1);
+ TINT32 iconsblx = std::max(tround((double)iconLx * sblx / m_lrp->m_res.lx), 1);
+ TINT32 iconsbly = std::max(tround((double)iconLy * sbly / m_lrp->m_res.ly), 1);
savebox = TRect(TPoint(iconsbx0, iconsby0), TDimension(iconsblx, iconsbly));
} else {
TINT32 iconsbx0 = tfloor((double)iconLx * sbx0 / m_lrp->m_res.lx);
diff --git a/toonz/sources/include/tcg/hpp/triangulate.hpp b/toonz/sources/include/tcg/hpp/triangulate.hpp
index 22a476deb..23809c3f3 100644
--- a/toonz/sources/include/tcg/hpp/triangulate.hpp
+++ b/toonz/sources/include/tcg/hpp/triangulate.hpp
@@ -292,16 +292,16 @@ void TriMeshStuff::DefaultEvaluator<mesh_type>::actionSort(
v3 = &mesh.vertex(mesh.otherFaceVertex(f1, e)).P();
length[1] = norm(*v3 - *v1);
length[2] = norm(*v3 - *v2);
- lengthMax = tmax(lengthMax, length[1], length[2]);
- lengthMin = tmin(lengthMin, length[1], length[2]);
+ lengthMax = std::max({lengthMax, length[1], length[2]});
+ lengthMin = std::min({lengthMin, length[1], length[2]});
}
if (f2 >= 0) {
v4 = &mesh.vertex(mesh.otherFaceVertex(f2, e)).P();
length[3] = norm(*v4 - *v1);
length[4] = norm(*v4 - *v2);
- lengthMax = tmax(lengthMax, length[3], length[4]);
- lengthMin = tmin(lengthMin, length[3], length[4]);
+ lengthMax = std::max({lengthMax, length[3], length[4]});
+ lengthMin = std::min({lengthMin, length[3], length[4]});
}
if (f1 >= 0 && f2 >= 0) {
@@ -314,7 +314,7 @@ void TriMeshStuff::DefaultEvaluator<mesh_type>::actionSort(
double m3 = (length[5] + length[1] + length[3]) / 3.0;
double m4 = (length[5] + length[2] + length[4]) / 3.0;
- if (tmax(m3, m4) < tmax(m1, m2) - 1e-5)
+ if (std::max(m3, m4) < std::max(m1, m2) - 1e-5)
actionSequence[count++] = ActionEvaluator::SWAP;
//NOTE: The original swap evaluation was about maximizing the minimal face angle.
diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h
index 621c0e200..554b427d8 100644
--- a/toonz/sources/include/tcommon.h
+++ b/toonz/sources/include/tcommon.h
@@ -90,22 +90,6 @@ typedef unsigned int UINT;
typedef unsigned char BYTE;
#endif
-template <class T>
-inline T tmin(T a, T b)
-{
- return a < b ? a : b;
-}
-template <class T>
-inline T tmax(T a, T b) { return a > b ? a : b; }
-template <class T>
-inline T tmin(T a, T b, T c) { return tmin(tmin(a, b), c); }
-template <class T>
-inline T tmax(T a, T b, T c) { return tmax(tmax(a, b), c); }
-template <class T>
-inline T tmin(T a, T b, T c, T d) { return tmin(tmin(a, b), tmin(c, d)); }
-template <class T>
-inline T tmax(T a, T b, T c, T d) { return tmax(tmax(a, b), tmax(c, d)); }
-
template <class T>
inline void tswap(T &a, T &b)
{
@@ -114,7 +98,7 @@ inline void tswap(T &a, T &b)
b = tmp;
}
template <class T>
-inline T tcrop(T x, T a, T b) { return tmin(tmax(x, a), b); }
+inline T tcrop(T x, T a, T b) { return std::min(std::max(x, a), b); }
template <class T>
inline void notLessThan(T threshold, T &x)
{
@@ -145,13 +129,6 @@ inline int troundp(double x)
return ((int)((x) + 0.5F));
}
-/* li metto dopo
- equivalenti a (int)floor() e (int)ceil() (ma piu' veloci)
- solo se la risoluzione dell'argomento e' inferiore ad 1
-#define FLOOR(x) ((int)(x) > (x) ? (int)(x)-1 : (int)(x))
-#define CEIL(x) ((int)(x) < (x) ? (int)(x)+1 : (int)(x))
-*/
-
/*! byteFromUshort(u) converts integer from [0..65535] to [0..255] */
inline UCHAR byteFromUshort(USHORT u)
{
diff --git a/toonz/sources/include/tcurves.h b/toonz/sources/include/tcurves.h
index 93ce4d429..090b07ca8 100644
--- a/toonz/sources/include/tcurves.h
+++ b/toonz/sources/include/tcurves.h
@@ -319,10 +319,11 @@ public:
//!Return rect that contains the cubic.
TRectD getBBox() const
{
- return TRectD(tmin(m_p0.x, m_p1.x, m_p2.x, m_p3.x),
- tmin(m_p0.y, m_p1.y, m_p2.y, m_p3.y),
- tmax(m_p0.x, m_p1.x, m_p2.x, m_p3.x),
- tmax(m_p0.y, m_p1.y, m_p2.y, m_p3.y));
+ return TRectD(
+ std::min({m_p0.x, m_p1.x, m_p2.x, m_p3.x}),
+ std::min({m_p0.y, m_p1.y, m_p2.y, m_p3.y}),
+ std::max({m_p0.x, m_p1.x, m_p2.x, m_p3.x}),
+ std::max({m_p0.y, m_p1.y, m_p2.y, m_p3.y}));
};
//!Return the point of cubic at parameter \b t.
diff --git a/toonz/sources/include/tfx.h b/toonz/sources/include/tfx.h
index 135b51e1e..0e3297e78 100644
--- a/toonz/sources/include/tfx.h
+++ b/toonz/sources/include/tfx.h
@@ -191,8 +191,8 @@ public:
TFxTimeRegion &operator+=(const TFxTimeRegion &rhs)
{
- m_start = tmin(m_start, rhs.m_start);
- m_end = tmax(m_end, rhs.m_end);
+ m_start = std::min(m_start, rhs.m_start);
+ m_end = std::max(m_end, rhs.m_end);
return *this;
}
diff --git a/toonz/sources/include/tgeometry.h b/toonz/sources/include/tgeometry.h
index 7e9315885..07357bb90 100644
--- a/toonz/sources/include/tgeometry.h
+++ b/toonz/sources/include/tgeometry.h
@@ -649,10 +649,10 @@ public:
TRectT(const TRectT &rect)
: x0(rect.x0), y0(rect.y0), x1(rect.x1), y1(rect.y1){};
TRectT(const TPointT<T> &p0, const TPointT<T> &p1) // non importa l'ordine
- : x0(tmin((T)p0.x, (T)p1.x)),
- y0(tmin((T)p0.y, (T)p1.y)),
- x1(tmax((T)p0.x, (T)p1.x)),
- y1(tmax((T)p0.y, (T)p1.y)){};
+ : x0(std::min((T)p0.x, (T)p1.x)),
+ y0(std::min((T)p0.y, (T)p1.y)),
+ x1(std::max((T)p0.x, (T)p1.x)),
+ y1(std::max((T)p0.y, (T)p1.y)){};
TRectT(const TPointT<T> &bottomLeft, const TDimensionT<T> &d);
TRectT(const TDimensionT<T> &d);
@@ -686,8 +686,8 @@ public:
return *this;
else
return TRectT<T>(
- tmin((T)x0, (T)rect.x0), tmin((T)y0, (T)rect.y0),
- tmax((T)x1, (T)rect.x1), tmax((T)y1, (T)rect.y1));
+ std::min((T)x0, (T)rect.x0), std::min((T)y0, (T)rect.y0),
+ std::max((T)x1, (T)rect.x1), std::max((T)y1, (T)rect.y1));
};
TRectT<T> &operator+=(const TRectT<T> &rect)
{ // unione
@@ -710,8 +710,8 @@ public:
return TRectT<T>();
else
return TRectT<T>(
- tmax((T)x0, (T)rect.x0), tmax((T)y0, (T)rect.y0),
- tmin((T)x1, (T)rect.x1), tmin((T)y1, (T)rect.y1));
+ std::max((T)x0, (T)rect.x0), std::max((T)y0, (T)rect.y0),
+ std::min((T)x1, (T)rect.x1), std::min((T)y1, (T)rect.y1));
};
TRectT<T> &operator+=(const TPointT<T> &p)
@@ -820,8 +820,9 @@ inline TRectD convert(const TRect &r)
*/
inline TRectD boundingBox(const TPointD &p0, const TPointD &p1)
{
- return TRectD(tmin(p0.x, p1.x), tmin(p0.y, p1.y),
- tmax(p0.x, p1.x), tmax(p0.y, p1.y));
+ return TRectD(
+ std::min(p0.x, p1.x), std::min(p0.y, p1.y),
+ std::max(p0.x, p1.x), std::max(p0.y, p1.y));
}
/*!
\relates TRectT
@@ -832,8 +833,9 @@ inline TRectD boundingBox(
const TPointD &p1,
const TPointD &p2)
{
- return TRectD(tmin(p0.x, p1.x, p2.x), tmin(p0.y, p1.y, p2.y),
- tmax(p0.x, p1.x, p2.x), tmax(p0.y, p1.y, p2.y));
+ return TRectD(
+ std::min({p0.x, p1.x, p2.x}), std::min({p0.y, p1.y, p2.y}),
+ std::max({p0.x, p1.x, p2.x}), std::max({p0.y, p1.y, p2.y}));
}
/*!
@@ -847,10 +849,10 @@ inline TRectD boundingBox(
const TPointD &p3)
{
return TRectD(
- tmin(p0.x, p1.x, p2.x, p3.x),
- tmin(p0.y, p1.y, p2.y, p3.y),
- tmax(p0.x, p1.x, p2.x, p3.x),
- tmax(p0.y, p1.y, p2.y, p3.y));
+ std::min({p0.x, p1.x, p2.x, p3.x}),
+ std::min({p0.y, p1.y, p2.y, p3.y}),
+ std::max({p0.x, p1.x, p2.x, p3.x}),
+ std::max({p0.y, p1.y, p2.y, p3.y}));
}
//-----------------------------------------------------------------------------
@@ -1136,21 +1138,6 @@ public:
Retruns the transformed box of the bounding box.
*/
TRectD operator*(const TRectD &rect) const;
- /*Sposto in tgeometry.cpp
- {
- if (rect != TConsts::infiniteRectD)
- {
- TPointD p1= *this * rect.getP00(),
- p2= *this * rect.getP01(),
- p3= *this * rect.getP10(),
- p4= *this * rect.getP11();
- return TRectD(tmin(p1.x,p2.x,p3.x,p4.x), tmin(p1.y,p2.y,p3.y,p4.y),
- tmax(p1.x,p2.x,p3.x,p4.x), tmax(p1.y,p2.y,p3.y,p4.y));
- }
- else
- return TConsts::infiniteRectD;
- };
- */
/*!
Returns a translated matrix that change the vector (u,v) in (x,y).
@@ -1159,23 +1146,11 @@ public:
\vec{0}&1\end{array}\right)\f$</p>
*/
TAffine place(double u, double v, double x, double y) const;
- /*Sposto in tgeometry.cpp
- {
- return TAffine(a11, a12, x - (a11 * u + a12 * v),
- a21, a22, y - (a21 * u + a22 * v));
- };
- */
+
/*!
See above.
*/
-
TAffine place(const TPointD &pIn, const TPointD &pOut) const;
- /*Sposto in tgeometry.cpp
- {
- return TAffine(a11, a12, pOut.x - (a11 * pIn.x + a12 * pIn.y),
- a21, a22, pOut.y - (a21 * pIn.x + a22 * pIn.y));
- };
- */
};
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/include/tinterval.h b/toonz/sources/include/tinterval.h
index a29c998b6..ab3c9bbd6 100644
--- a/toonz/sources/include/tinterval.h
+++ b/toonz/sources/include/tinterval.h
@@ -289,7 +289,7 @@ inline TInterval square(const TInterval &w)
return TInterval(b, a); // return [m_max^2, m_min^2]
else {
assert(w.m_min < 0 && 0 < w.m_max);
- return TInterval(0, tmax(a, b)); // [0, max(w.m_min^2, w.m_max^2)]
+ return TInterval(0, std::max(a, b)); // [0, max(w.m_min^2, w.m_max^2)]
}
}
//-----------------------------------------------------
@@ -306,8 +306,8 @@ inline TInterval intersection(const TInterval &a, const TInterval &b)
{
// return a_intersezione_b (insiemistico) se questa e' non vuota, altrimenti
// return TInterval() (intervallo vuoto)
- double min = tmax(a.m_min, b.m_min);
- double max = tmin(a.m_max, b.m_max);
+ double min = std::max(a.m_min, b.m_min);
+ double max = std::min(a.m_max, b.m_max);
if (min <= max) // a.isEmpty() || b.isEmpty() => (min >= 1 && max <= -1) => min > max
return TInterval(min, max);
else
@@ -335,7 +335,7 @@ inline TInterval createErrorTInterval(double center,
// implementare l'artimetica double standard IEEE.
assert(minError >= 0);
const double relativeDoubleError = 1e-13;
- double error = tmax(fabs(center) * relativeDoubleError, minError);
+ double error = std::max(fabs(center) * relativeDoubleError, minError);
return TInterval(center - error, center + error);
}
//-----------------------------------------------------
diff --git a/toonz/sources/include/toonz/ikjacobian.h b/toonz/sources/include/toonz/ikjacobian.h
index a90473243..70db29d95 100644
--- a/toonz/sources/include/toonz/ikjacobian.h
+++ b/toonz/sources/include/toonz/ikjacobian.h
@@ -134,7 +134,7 @@ inline void VectorRn::SetLength(long newLength)
assert(newLength > 0);
if (newLength > AllocLength) {
delete x;
- AllocLength = tmax(newLength, AllocLength << 1);
+ AllocLength = std::max(newLength, AllocLength << 1);
x = new double[AllocLength];
}
length = newLength;
@@ -427,7 +427,7 @@ inline void MatrixRmn::SetSize(long numRows, long numCols)
long newLength = numRows * numCols;
if (newLength > AllocSize) {
delete x;
- AllocSize = tmax(newLength, AllocSize << 1);
+ AllocSize = std::max(newLength, AllocSize << 1);
x = new double[AllocSize];
}
NumRows = numRows;
diff --git a/toonz/sources/include/toonzqt/swatchviewer.h b/toonz/sources/include/toonzqt/swatchviewer.h
index fa5739eb0..f5d9f77b1 100644
--- a/toonz/sources/include/toonzqt/swatchviewer.h
+++ b/toonz/sources/include/toonzqt/swatchviewer.h
@@ -70,8 +70,8 @@ public:
void paint(const TRaster32P &ras)
{
int n = 4, min = 4;
- TDimensionD d(tmax(min, ras->getLx() / n), tmax(min, ras->getLy() / n));
- d.lx = d.ly = tmax(d.lx, d.ly);
+ TDimensionD d(std::max(min, ras->getLx() / n), std::max(min, ras->getLy() / n));
+ d.lx = d.ly = std::max(d.lx, d.ly);
TRop::checkBoard(ras, m_c0, m_c1, d, TPointD());
}
};
diff --git a/toonz/sources/include/tpixelutils.h b/toonz/sources/include/tpixelutils.h
index 690b0e2b3..63f03250d 100644
--- a/toonz/sources/include/tpixelutils.h
+++ b/toonz/sources/include/tpixelutils.h
@@ -316,7 +316,7 @@ DVAPI inline TPixel32 overPixOnBlack(const TPixel32 &top)
DVAPI inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top)
{
- return TPixelGR8(tmin(bot.value, top.value));
+ return TPixelGR8(std::min(bot.value, top.value));
}
//-----------------------------------------------------------------------------
@@ -364,17 +364,17 @@ DVAPI inline void premult(TPixel64 &pix)
DVAPI inline void depremult(TPixel32 &pix)
{
float fac = 255.0f / pix.m;
- pix.r = tmin(pix.r * fac, 255.0f);
- pix.g = tmin(pix.g * fac, 255.0f);
- pix.b = tmin(pix.b * fac, 255.0f);
+ pix.r = std::min(pix.r * fac, 255.0f);
+ pix.g = std::min(pix.g * fac, 255.0f);
+ pix.b = std::min(pix.b * fac, 255.0f);
}
DVAPI inline void depremult(TPixel64 &pix)
{
double fac = 65535.0 / pix.m;
- pix.r = tmin(pix.r * fac, 65535.0);
- pix.g = tmin(pix.g * fac, 65535.0);
- pix.b = tmin(pix.b * fac, 65535.0);
+ pix.r = std::min(pix.r * fac, 65535.0);
+ pix.g = std::min(pix.g * fac, 65535.0);
+ pix.b = std::min(pix.b * fac, 65535.0);
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/include/tsound_t.h b/toonz/sources/include/tsound_t.h
index a6d8bc84f..880849eb1 100644
--- a/toonz/sources/include/tsound_t.h
+++ b/toonz/sources/include/tsound_t.h
@@ -336,7 +336,7 @@ public:
const T *srcSample = src.samples() + ss0;
const T *srcEndSample =
- srcSample + tmin((TINT32)(ss1 - ss0 + 1), (TINT32)(getSampleCount() - dst_s0));
+ srcSample + std::min((TINT32)(ss1 - ss0 + 1), (TINT32)(getSampleCount() - dst_s0));
T *dstSample = samples() + dst_s0;
diff --git a/toonz/sources/stdfx/bodyhighlightfx.cpp b/toonz/sources/stdfx/bodyhighlightfx.cpp
index 8a90bfed0..f6cedb23e 100644
--- a/toonz/sources/stdfx/bodyhighlightfx.cpp
+++ b/toonz/sources/stdfx/bodyhighlightfx.cpp
@@ -61,7 +61,7 @@ void doBlur(CHANNEL_TYPE *greymap, const TRasterPT<PIXEL> &rin, int blur)
//We'll need a temporary col for storing sums
std::unique_ptr<unsigned long[]> tempCol(new unsigned long[rin->getLy()]);
- int edge = tmin(blur + 1, rin->getLy());
+ int edge = std::min(blur + 1, rin->getLy());
for (i = 0; i < rin->getLx(); ++i) {
PIXEL *lineSrcPix = rin->pixels(0) + i;
@@ -114,7 +114,7 @@ void doBlur(CHANNEL_TYPE *greymap, const TRasterPT<PIXEL> &rin, int blur)
//We'll need a temporary row for sums
std::unique_ptr<unsigned long[]> tempRow(new unsigned long[rin->getLx()]);
- edge = tmin(blur + 1, rin->getLx());
+ edge = std::min(blur + 1, rin->getLx());
for (j = 0; j < rin->getLy(); ++j) {
CHANNEL_TYPE *lineSrcPix = greymap + j * wrapOut;
@@ -178,9 +178,9 @@ void myOver(PIXEL &pixout, const PIXEL &pixin, const PIXEL &color)
template <typename PIXEL>
void myAdd(PIXEL &pixout, const PIXEL &pixin, const PIXEL &color)
{
- pixout.r = tmin(pixin.r + color.r, PIXEL::maxChannelValue);
- pixout.g = tmin(pixin.g + color.g, PIXEL::maxChannelValue);
- pixout.b = tmin(pixin.b + color.b, PIXEL::maxChannelValue);
+ pixout.r = std::min(pixin.r + color.r, PIXEL::maxChannelValue);
+ pixout.g = std::min(pixin.g + color.g, PIXEL::maxChannelValue);
+ pixout.b = std::min(pixin.b + color.b, PIXEL::maxChannelValue);
}
//------------------------------------------------------------------------------
@@ -188,9 +188,9 @@ void myAdd(PIXEL &pixout, const PIXEL &pixin, const PIXEL &color)
template <typename PIXEL>
void mySub(PIXEL &pixout, const PIXEL &pixin, const PIXEL &color)
{
- pixout.r = tmax(pixin.r - color.r, 0);
- pixout.g = tmax(pixin.g - color.g, 0);
- pixout.b = tmax(pixin.b - color.b, 0);
+ pixout.r = std::max(pixin.r - color.r, 0);
+ pixout.g = std::max(pixin.g - color.g, 0);
+ pixout.b = std::max(pixin.b - color.b, 0);
}
//------------------------------------------------------------------------------
diff --git a/toonz/sources/stdfx/changecolorfx.cpp b/toonz/sources/stdfx/changecolorfx.cpp
index bf4d6bdc5..e5a897dbc 100644
--- a/toonz/sources/stdfx/changecolorfx.cpp
+++ b/toonz/sources/stdfx/changecolorfx.cpp
@@ -12,8 +12,8 @@ static void OLDRGB2HSV(double r, double g, double b,
double max, min;
double delta;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
*v = max;
diff --git a/toonz/sources/stdfx/cornerpinfx.cpp b/toonz/sources/stdfx/cornerpinfx.cpp
index 3be7bcb3b..c9a425a35 100644
--- a/toonz/sources/stdfx/cornerpinfx.cpp
+++ b/toonz/sources/stdfx/cornerpinfx.cpp
@@ -252,10 +252,10 @@ void CornerPinFx::transform(
//(especially for vector images).
double scale = 0;
- scale = tmax(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
- scale = tmax(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
- scale = tmax(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
- scale = tmax(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
+ scale = std::max(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
+ scale = std::max(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
+ scale = std::max(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
+ scale = std::max(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
TAffine A_1B(getPort1Affine(frame));
TAffine B(infoOnOutput.m_affine * A_1B);
@@ -358,10 +358,10 @@ void CornerPinFx::safeTransform(
TPointD affP11_b(infoOnInput.m_affine * m_p11_b->getValue(frame));
TRectD source;
- source.x0 = tmin(affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x);
- source.y0 = tmin(affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y);
- source.x1 = tmax(affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x);
- source.y1 = tmax(affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y);
+ source.x0 = std::min({affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x});
+ source.y0 = std::min({affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y});
+ source.x1 = std::max({affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x});
+ source.y1 = std::max({affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y});
rectOnInput *= source;
}
@@ -509,10 +509,10 @@ void CornerPinFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri
TPointD p11_a = m_p11_a->getValue(frame);
double scale = 0;
- scale = tmax(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
- scale = tmax(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
- scale = tmax(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
- scale = tmax(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
+ scale = std::max(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
+ scale = std::max(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
+ scale = std::max(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
+ scale = std::max(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
TAffine A_1B(getPort1Affine(frame));
TAffine B(ri.m_affine * A_1B);
@@ -642,7 +642,7 @@ int CornerPinFx::getMemoryRequirement(const TRectD &rect, double frame, const TR
safeTransform(frame, 1, rect, info, inRect, riNew, inBBox);
inRect *= inBBox;
- return tmax(TRasterFx::memorySize(rect, info.m_bpp), TRasterFx::memorySize(inRect, riNew.m_bpp));
+ return std::max(TRasterFx::memorySize(rect, info.m_bpp), TRasterFx::memorySize(inRect, riNew.m_bpp));
}
//-------------------------------------------------------------------------
@@ -651,10 +651,10 @@ TRectD CornerPinFx::getContainingBox(const FourPoints &points)
{
if(points.m_p00==points.m_p01 && points.m_p01==points.m_p10 && points.m_p10==points.m_p11)
return TRectD(points.m_p00,points.m_p00);
- double xMax=tmax(points.m_p00.x,points.m_p01.x,points.m_p10.x,points.m_p11.x);
- double yMax=tmax(points.m_p00.y,points.m_p01.y,points.m_p10.y,points.m_p11.y);
- double xMin=tmin(points.m_p00.x,points.m_p01.x,points.m_p10.x,points.m_p11.x);
- double yMin=tmin(points.m_p00.y,points.m_p01.y,points.m_p10.y,points.m_p11.y);
+ double xMax=std::max(points.m_p00.x,points.m_p01.x,points.m_p10.x,points.m_p11.x);
+ double yMax=std::max(points.m_p00.y,points.m_p01.y,points.m_p10.y,points.m_p11.y);
+ double xMin=std::min(points.m_p00.x,points.m_p01.x,points.m_p10.x,points.m_p11.x);
+ double yMin=std::min(points.m_p00.y,points.m_p01.y,points.m_p10.y,points.m_p11.y);
return TRectD(xMin,yMin,xMax, yMax);
}
*/
diff --git a/toonz/sources/stdfx/freedistortfx.cpp b/toonz/sources/stdfx/freedistortfx.cpp
index b502b528a..809857f18 100644
--- a/toonz/sources/stdfx/freedistortfx.cpp
+++ b/toonz/sources/stdfx/freedistortfx.cpp
@@ -248,10 +248,10 @@ bool FreeDistortBaseFx::doGetBBox(double frame, TRectD &bBox, const TRenderSetti
}*/
/*TRectD source;
- source.x0 = tmin(p00_b.x, p10_b.x, p01_b.x, p11_b.x);
- source.y0 = tmin(p00_b.y, p10_b.y, p01_b.y, p11_b.y);
- source.x1 = tmax(p00_b.x, p10_b.x, p01_b.x, p11_b.x);
- source.y1 = tmax(p00_b.y, p10_b.y, p01_b.y, p11_b.y);
+ source.x0 = std::min(p00_b.x, p10_b.x, p01_b.x, p11_b.x);
+ source.y0 = std::min(p00_b.y, p10_b.y, p01_b.y, p11_b.y);
+ source.x1 = std::max(p00_b.x, p10_b.x, p01_b.x, p11_b.x);
+ source.y1 = std::max(p00_b.y, p10_b.y, p01_b.y, p11_b.y);
bBox *= source;
int distortType = m_distortType->getValue();
@@ -276,10 +276,10 @@ bool FreeDistortBaseFx::doGetBBox(double frame, TRectD &bBox, const TRenderSetti
//Further, we will also avoid the assumption that the bbox
//is defined by that of destination points...
/*TRectD result;
- result.x0 = tmin(p00_a.x, p10_a.x, p01_a.x, p11_a.x);
- result.y0 = tmin(p00_a.y, p10_a.y, p01_a.y, p11_a.y);
- result.x1 = tmax(p00_a.x, p10_a.x, p01_a.x, p11_a.x);
- result.y1 = tmax(p00_a.y, p10_a.y, p01_a.y, p11_a.y);
+ result.x0 = std::min(p00_a.x, p10_a.x, p01_a.x, p11_a.x);
+ result.y0 = std::min(p00_a.y, p10_a.y, p01_a.y, p11_a.y);
+ result.x1 = std::max(p00_a.x, p10_a.x, p01_a.x, p11_a.x);
+ result.y1 = std::max(p00_a.y, p10_a.y, p01_a.y, p11_a.y);
bBox = result; //bBox *= result;*/
} else {
bBox = TRectD();
@@ -287,7 +287,7 @@ bool FreeDistortBaseFx::doGetBBox(double frame, TRectD &bBox, const TRenderSetti
}
if (m_upBlur->getValue(frame) > 0 || m_downBlur->getValue(frame) > 0) {
- int brad = tmax((int)m_upBlur->getValue(frame), (int)m_downBlur->getValue(frame));
+ int brad = std::max((int)m_upBlur->getValue(frame), (int)m_downBlur->getValue(frame));
bBox.x0 -= brad;
bBox.x1 += brad;
bBox.y0 -= brad;
@@ -327,10 +327,10 @@ void FreeDistortBaseFx::transform(
infoOnInput = infoOnOutput;
double scale = 0;
- scale = tmax(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
- scale = tmax(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
- scale = tmax(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
- scale = tmax(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
+ scale = std::max(scale, norm(p10_a - p00_a) / norm(p10_b - p00_b));
+ scale = std::max(scale, norm(p01_a - p00_a) / norm(p01_b - p00_b));
+ scale = std::max(scale, norm(p11_a - p10_a) / norm(p11_b - p10_b));
+ scale = std::max(scale, norm(p11_a - p01_a) / norm(p11_b - p01_b));
scale *= sqrt(fabs(infoOnInput.m_affine.det()));
@@ -419,10 +419,10 @@ void FreeDistortBaseFx::safeTransform(
TPointD affP11_b(infoOnInput.m_affine * m_p11_b->getValue(frame));
TRectD source;
- source.x0 = tmin(affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x);
- source.y0 = tmin(affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y);
- source.x1 = tmax(affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x);
- source.y1 = tmax(affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y);
+ source.x0 = std::min({affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x});
+ source.y0 = std::min({affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y});
+ source.x1 = std::max({affP00_b.x, affP10_b.x, affP01_b.x, affP11_b.x});
+ source.y1 = std::max({affP00_b.y, affP10_b.y, affP01_b.y, affP11_b.y});
rectOnInput *= source;
}
@@ -627,7 +627,7 @@ void doBlur(TRasterPT<PIX> &r,
lx = r->getLx();
ly = r->getLy();
wrap = r->getWrap();
- blur_max = (int)tmax(blur0, blur1);
+ blur_max = (int)std::max(blur0, blur1);
brad = tceil(blur_max);
//assert(y0 <= brad && y1 >= r->getLy()-1 - 2 * brad + y0);
@@ -637,12 +637,12 @@ void doBlur(TRasterPT<PIX> &r,
blur_incr = (blur1 - blur0) / den;
transp_incr = (transp0 - transp1) / den;
- row = new PIX[tmax(lx, ly)];
+ row = new PIX[std::max(lx, ly)];
r->lock();
bufin = r->pixels(0);
- for (i = 0, cur_blur = blur0 + (blur1 - blur0) * (i - y0) / den, 0.0, actual_blur = tmax(cur_blur, 0.0);
+ for (i = 0, cur_blur = blur0 + (blur1 - blur0) * (i - y0) / den, 0.0, actual_blur = std::max(cur_blur, 0.0);
i < ly;
- i++, bufin += wrap, cur_blur += blur_incr, actual_blur = tmax(cur_blur, 0.0)) {
+ i++, bufin += wrap, cur_blur += blur_incr, actual_blur = std::max(cur_blur, 0.0)) {
pixin = bufin;
for (j = 0; j < lx; j++, pixin++) {
if (cur_blur > 1.0)
@@ -660,9 +660,9 @@ void doBlur(TRasterPT<PIX> &r,
pixin = bufin;
pixout = bufout;
- for (j = 0, cur_blur = blur0 + (blur1 - blur0) * (j - y0) / den, actual_blur = tmax(cur_blur, 0.0);
+ for (j = 0, cur_blur = blur0 + (blur1 - blur0) * (j - y0) / den, actual_blur = std::max(cur_blur, 0.0);
j < ly;
- j++, pixin += wrap, cur_blur += blur_incr, actual_blur = tmax(cur_blur, 0.0)) {
+ j++, pixin += wrap, cur_blur += blur_incr, actual_blur = std::max(cur_blur, 0.0)) {
if (cur_blur > 1.0)
filterPixel(pixin, wrap, row + j, actual_blur, j, ly);
else
@@ -670,9 +670,9 @@ void doBlur(TRasterPT<PIX> &r,
}
if (transp0 > 0 || transp1 > 0)
- for (j = 0, cur_transp = 1 - transp0 + (transp0 - transp1) * (j - y0) / den, actual_transp = tmax(cur_transp, 0.0);
+ for (j = 0, cur_transp = 1 - transp0 + (transp0 - transp1) * (j - y0) / den, actual_transp = std::max(cur_transp, 0.0);
j < ly;
- j++, pixout += wrap, cur_transp += transp_incr, actual_transp = tmax(cur_transp, 0.0)) {
+ j++, pixout += wrap, cur_transp += transp_incr, actual_transp = std::max(cur_transp, 0.0)) {
pixout->r = troundp(row[j].r * actual_transp);
pixout->g = troundp(row[j].g * actual_transp);
pixout->b = troundp(row[j].b * actual_transp);
@@ -767,7 +767,7 @@ void FreeDistortBaseFx::doCompute(TTile &tile, double frame, const TRenderSettin
double downBlur = m_downBlur->getValue(frame) * scale;
double upBlur = m_upBlur->getValue(frame) * scale;
- int brad = tceil(tmax(downBlur, upBlur));
+ int brad = tceil(std::max(downBlur, upBlur));
inRect = inRect.enlarge(brad);
diff --git a/toonz/sources/stdfx/hsvkeyfx.cpp b/toonz/sources/stdfx/hsvkeyfx.cpp
index 575665479..25b24aa19 100644
--- a/toonz/sources/stdfx/hsvkeyfx.cpp
+++ b/toonz/sources/stdfx/hsvkeyfx.cpp
@@ -98,12 +98,12 @@ void HSVKeyFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
double v_range = m_vrange->getValue(frame);
bool gender = (int)m_gender->getValue();
- double lowH = tmax(0.0, h_ref - h_range);
- double highH = tmin(360.0, h_ref + h_range);
- double lowS = tmax(0.0, s_ref - s_range);
- double highS = tmin(1.0, s_ref + s_range);
- double lowV = tmax(0.0, v_ref - v_range);
- double highV = tmin(1.0, v_ref + v_range);
+ double lowH = std::max(0.0, h_ref - h_range);
+ double highH = std::min(360.0, h_ref + h_range);
+ double lowS = std::max(0.0, s_ref - s_range);
+ double highS = std::min(1.0, s_ref + s_range);
+ double lowV = std::max(0.0, v_ref - v_range);
+ double highV = std::min(1.0, v_ref + v_range);
TRaster32P raster32 = tile.getRaster();
diff --git a/toonz/sources/stdfx/hsvutil.cpp b/toonz/sources/stdfx/hsvutil.cpp
index 98bf6ab1e..197642fc2 100644
--- a/toonz/sources/stdfx/hsvutil.cpp
+++ b/toonz/sources/stdfx/hsvutil.cpp
@@ -9,8 +9,8 @@ void OLDRGB2HSV(double r, double g, double b,
double max, min;
double delta;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
*v = max;
diff --git a/toonz/sources/stdfx/iwa_motionblurfx.cpp b/toonz/sources/stdfx/iwa_motionblurfx.cpp
index 3887b34e7..0dda8e8f2 100644
--- a/toonz/sources/stdfx/iwa_motionblurfx.cpp
+++ b/toonz/sources/stdfx/iwa_motionblurfx.cpp
@@ -126,10 +126,10 @@ void Iwa_MotionBlurCompFx::makeMotionBlurFilter_CPU(float *filter_p,
float4 p1 = pointsTable[v + 1];
/*- 範囲内に無ければcontinue -*/
- if (pos.x < tmin(p0.x, p1.x) - 1.0f ||
- pos.x > tmax(p0.x, p1.x) + 1.0f ||
- pos.y < tmin(p0.y, p1.y) - 1.0f ||
- pos.y > tmax(p0.y, p1.y) + 1.0f)
+ if (pos.x < std::min(p0.x, p1.x) - 1.0f ||
+ pos.x > std::max(p0.x, p1.x) + 1.0f ||
+ pos.y < std::min(p0.y, p1.y) - 1.0f ||
+ pos.y > std::max(p0.y, p1.y) + 1.0f)
continue;
/*- 範囲内にあるので、線分と点の距離を得る -*/
diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp
index d9b8de35f..a57321b12 100644
--- a/toonz/sources/stdfx/iwa_particlesengine.cpp
+++ b/toonz/sources/stdfx/iwa_particlesengine.cpp
@@ -242,7 +242,7 @@ void Iwa_Particles_Engine::roll_particles(TTile *tile, /*-結果を格納
particleOrigins);
/*- 粒子が出きったらもう出さない -*/
- int actualBirthParticles = tmin(genPartNum, particleOrigins.size());
+ int actualBirthParticles = std::min(genPartNum, particleOrigins.size());
/*- 出発する粒子のインデックス -*/
QList<int> leavingPartIndex;
if (myregions.size() && values.source_ctrl_val != Iwa_TiledParticlesFx::CTRL_NONE) {
@@ -801,7 +801,7 @@ void Iwa_Particles_Engine::render_particles(TFlash *flash, /*- 0 が入
partScales.find(ndxPair);
if (it != partScales.end())
- it->second = tmax(part.scale, it->second);
+ it->second = std::max(part.scale, it->second);
else
partScales[ndxPair] = part.scale;
}
@@ -814,7 +814,7 @@ void Iwa_Particles_Engine::render_particles(TFlash *flash, /*- 0 が入
std::map<std::pair<int, int>, float>::iterator it =
partScales.find(ndxPair);
if (it != partScales.end())
- it->second = tmax((float)values.scale_val.second, it->second);
+ it->second = std::max((float)values.scale_val.second, it->second);
else
partScales[ndxPair] = values.scale_val.second;
}
diff --git a/toonz/sources/stdfx/iwa_particlesfx.cpp b/toonz/sources/stdfx/iwa_particlesfx.cpp
index f7040f399..04bcc08da 100644
--- a/toonz/sources/stdfx/iwa_particlesfx.cpp
+++ b/toonz/sources/stdfx/iwa_particlesfx.cpp
@@ -361,7 +361,7 @@ void Iwa_TiledParticlesFx::doDryCompute(TRectD &rect, double frame, const TRende
infoOnInput.m_bpp = 64; // Control ports rendered at 32 bit - since not visible.
for (i = startframe - 1; i <= curr_frame; ++i) {
- double frame = tmax(0, i);
+ double frame = std::max(0, i);
for (j = 0; j < inputPortCount; ++j) {
TFxPort *port = getInputPort(j);
diff --git a/toonz/sources/stdfx/iwa_particlesmanager.cpp b/toonz/sources/stdfx/iwa_particlesmanager.cpp
index 85ffa8af1..148624df9 100644
--- a/toonz/sources/stdfx/iwa_particlesmanager.cpp
+++ b/toonz/sources/stdfx/iwa_particlesmanager.cpp
@@ -68,7 +68,7 @@ void Iwa_ParticlesManager::FrameData::buildMaxTrail()
//Store the maximum trail of each particle
std::list<Iwa_Particle>::iterator it;
for (it = m_particles.begin(); it != m_particles.end(); ++it)
- m_maxTrail = tmax(m_maxTrail, it->trail);
+ m_maxTrail = std::max(m_maxTrail, it->trail);
}
//-------------------------------------------------------------------------
diff --git a/toonz/sources/stdfx/kaleido.cpp b/toonz/sources/stdfx/kaleido.cpp
index 23783e08b..bd915b93d 100644
--- a/toonz/sources/stdfx/kaleido.cpp
+++ b/toonz/sources/stdfx/kaleido.cpp
@@ -119,10 +119,10 @@ private:
void KaleidoFx::buildSectionRect(TRectD &inRect, double angle)
{
- inRect.y0 = tmax(inRect.y0, 0.0);
+ inRect.y0 = std::max(inRect.y0, 0.0);
if (angle <= TConsts::pi_2) {
- inRect.x0 = tmax(inRect.x0, 0.0);
- inRect.y1 = tmin(inRect.y1, inRect.x1 * tan(angle));
+ inRect.x0 = std::max(inRect.x0, 0.0);
+ inRect.y1 = std::min(inRect.y1, inRect.x1 * tan(angle));
}
}
@@ -130,7 +130,7 @@ void KaleidoFx::buildSectionRect(TRectD &inRect, double angle)
void KaleidoFx::rotate(TRectD &rect)
{
- TPointD pMax(tmax(-rect.x0, rect.x1), tmax(-rect.y0, rect.y1));
+ TPointD pMax(std::max(-rect.x0, rect.x1), std::max(-rect.y0, rect.y1));
double normPMax = norm(pMax);
rect = TRectD(-normPMax, -normPMax, normPMax, normPMax);
diff --git a/toonz/sources/stdfx/linearwavefx.cpp b/toonz/sources/stdfx/linearwavefx.cpp
index 4dedaa193..38fa6c70e 100644
--- a/toonz/sources/stdfx/linearwavefx.cpp
+++ b/toonz/sources/stdfx/linearwavefx.cpp
@@ -238,7 +238,7 @@ public:
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
- return tmax(
+ return std::max(
TRasterFx::memorySize(warpedComputeRect, info.m_bpp),
TRasterFx::memorySize(warperComputeRect, info.m_bpp));
}
diff --git a/toonz/sources/stdfx/localblurfx.cpp b/toonz/sources/stdfx/localblurfx.cpp
index 78040dc6a..2869ffc2c 100644
--- a/toonz/sources/stdfx/localblurfx.cpp
+++ b/toonz/sources/stdfx/localblurfx.cpp
@@ -124,8 +124,8 @@ void filterLine(Pix *lineIn, int wrapIn, Grey *lineGr, int wrapGr, Pix *lineOut,
// NOTE: The normalization factor with blur (not integer) would be:
// 1.0 / (1 + 2 * blurI - (blurI / blur) * (blurI + 1)) -- could be done using a factors table
- iLeft = tmax(i - tfloor(blur) - 1, 0);
- iRight = tmin(i + tfloor(blur), length - 1);
+ iLeft = std::max(i - tfloor(blur) - 1, 0);
+ iRight = std::min(i + tfloor(blur), length - 1);
pixOut->r = troundp(
kLeft * (sums.m_sumsIX_r[i] - sums.m_sumsIX_r[iLeft]) + kRight * (sums.m_sumsIX_r[iRight] - sums.m_sumsIX_r[i]) +
diff --git a/toonz/sources/stdfx/mosaicfx.cpp b/toonz/sources/stdfx/mosaicfx.cpp
index daf5699b7..5f84221cc 100644
--- a/toonz/sources/stdfx/mosaicfx.cpp
+++ b/toonz/sources/stdfx/mosaicfx.cpp
@@ -267,8 +267,8 @@ void doMosaic(TRasterPT<PIXEL> ras, TRasterPT<PIXEL> cellsRas, int step, const T
x1 = x0 + step, y1 = y0 + step;
//Retrieve the cell buffer position and its eventual adjustment
- int u0 = tmax(x0, 0), v0 = tmax(y0, 0);
- int u1 = tmin(x1, lx), v1 = tmin(y1, ly);
+ int u0 = std::max(x0, 0), v0 = std::max(y0, 0);
+ int u1 = std::min(x1, lx), v1 = std::min(y1, ly);
PIXEL *cb = buffer + u0 + v0 * wrap;
diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp
index 2d6fbe068..5572d2b44 100644
--- a/toonz/sources/stdfx/particlesengine.cpp
+++ b/toonz/sources/stdfx/particlesengine.cpp
@@ -540,7 +540,7 @@ void Particles_Engine::render_particles(
partScales.find(ndxPair);
if (it != partScales.end())
- it->second = tmax(part.scale, it->second);
+ it->second = std::max(part.scale, it->second);
else
partScales[ndxPair] = part.scale;
}
diff --git a/toonz/sources/stdfx/particlesfx.cpp b/toonz/sources/stdfx/particlesfx.cpp
index 99dcb48c9..eb671e4e8 100644
--- a/toonz/sources/stdfx/particlesfx.cpp
+++ b/toonz/sources/stdfx/particlesfx.cpp
@@ -286,7 +286,7 @@ void ParticlesFx::doDryCompute(TRectD &rect, double frame, const TRenderSettings
infoOnInput.m_bpp = 32; // Control ports rendered at 32 bit - since not visible.
for (i = startframe - 1; i <= curr_frame; ++i) {
- double frame = tmax(0, i);
+ double frame = std::max(0, i);
for (j = 0; j < inputPortCount; ++j) {
TFxPort *port = getInputPort(j);
diff --git a/toonz/sources/stdfx/particlesmanager.cpp b/toonz/sources/stdfx/particlesmanager.cpp
index d27af2470..81b71336b 100644
--- a/toonz/sources/stdfx/particlesmanager.cpp
+++ b/toonz/sources/stdfx/particlesmanager.cpp
@@ -65,7 +65,7 @@ void ParticlesManager::FrameData::buildMaxTrail()
//Store the maximum trail of each particle
std::list<Particle>::iterator it;
for (it = m_particles.begin(); it != m_particles.end(); ++it)
- m_maxTrail = tmax(m_maxTrail, it->trail);
+ m_maxTrail = std::max(m_maxTrail, it->trail);
}
//-------------------------------------------------------------------------
diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp
index e0e7944a0..88bdf1e15 100644
--- a/toonz/sources/stdfx/pins.cpp
+++ b/toonz/sources/stdfx/pins.cpp
@@ -413,17 +413,21 @@ void subdivision(const TPointD &p00,
details--;
- TRectD r1 = TRectD(tmin(A.x, L1.x, M.x, H1.x), tmin(A.y, L1.y, M.y, H1.y),
- tmax(A.x, L1.x, M.x, H1.x), tmax(A.y, L1.y, M.y, H1.y));
+ TRectD r1 = TRectD(
+ std::min({A.x, L1.x, M.x, H1.x}), std::min({A.y, L1.y, M.y, H1.y}),
+ std::max({A.x, L1.x, M.x, H1.x}), std::max({A.y, L1.y, M.y, H1.y}));
- TRectD r2 = TRectD(tmin(L1.x, B.x, H2.x, M.x), tmin(L1.y, B.y, H2.y, M.y),
- tmax(L1.x, B.x, H2.x, M.x), tmax(L1.y, B.y, H2.y, M.y));
+ TRectD r2 = TRectD(
+ std::min({L1.x, B.x, H2.x, M.x}), std::min({L1.y, B.y, H2.y, M.y}),
+ std::max({L1.x, B.x, H2.x, M.x}), std::max({L1.y, B.y, H2.y, M.y}));
- TRectD r3 = TRectD(tmin(M.x, H2.x, C.x, L2.x), tmin(M.y, H2.y, C.y, L2.y),
- tmax(M.x, H2.x, C.x, L2.x), tmax(M.y, H2.y, C.y, L2.y));
+ TRectD r3 = TRectD(
+ std::min({M.x, H2.x, C.x, L2.x}), std::min({M.y, H2.y, C.y, L2.y}),
+ std::max({M.x, H2.x, C.x, L2.x}), std::max({M.y, H2.y, C.y, L2.y}));
- TRectD r4 = TRectD(tmin(H1.x, M.x, L2.x, D.x), tmin(H1.y, M.y, L2.y, D.y),
- tmax(H1.x, M.x, L2.x, D.x), tmax(H1.y, M.y, L2.y, D.y));
+ TRectD r4 = TRectD(
+ std::min({H1.x, M.x, L2.x, D.x}), std::min({H1.y, M.y, L2.y, D.y}),
+ std::max({H1.x, M.x, L2.x, D.x}), std::max({H1.y, M.y, L2.y, D.y}));
if (r1.overlaps(clippingRect))
subdivision(A, L1, M, H1, tex00, texA, texM, texD, clippingRect, details);
diff --git a/toonz/sources/stdfx/radialblurfx.cpp b/toonz/sources/stdfx/radialblurfx.cpp
index 10724ca27..56dd6e617 100644
--- a/toonz/sources/stdfx/radialblurfx.cpp
+++ b/toonz/sources/stdfx/radialblurfx.cpp
@@ -49,8 +49,8 @@ public:
double d3 = p3.x * p3.x + p3.y * p3.y;
double d4 = p4.x * p4.x + p4.y * p4.y;
- double maxD = tmax(tmax(tmax(d3, d4), d2), d1);
- return tround(tmax(sqrt(maxD) - radius, 0.0)) * intensity;
+ double maxD = std::max(std::max(std::max(d3, d4), d2), d1);
+ return tround(std::max(sqrt(maxD) - radius, 0.0)) * intensity;
}
void enlarge(
@@ -204,7 +204,7 @@ void RadialBlurFx::enlarge(
double maxRange = getMaxBraid(enlargedBbox, frame, ri.m_affine);
/*- 最低でも1pixel追加する -*/
- maxRange = tmax(maxRange, 1.0);
+ maxRange = std::max(maxRange, 1.0);
enlargedBbox = enlargedBbox.enlarge(maxRange);
enlargedGeom = enlargedGeom.enlarge(maxRange);
diff --git a/toonz/sources/stdfx/randomwavefx.cpp b/toonz/sources/stdfx/randomwavefx.cpp
index 4c8546868..20e304935 100644
--- a/toonz/sources/stdfx/randomwavefx.cpp
+++ b/toonz/sources/stdfx/randomwavefx.cpp
@@ -273,7 +273,7 @@ public:
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
- return tmax(
+ return std::max(
TRasterFx::memorySize(warpedComputeRect, info.m_bpp),
TRasterFx::memorySize(warperComputeRect, info.m_bpp));
}
diff --git a/toonz/sources/stdfx/raylitfx.cpp b/toonz/sources/stdfx/raylitfx.cpp
index 68e28df31..35fb7e40b 100644
--- a/toonz/sources/stdfx/raylitfx.cpp
+++ b/toonz/sources/stdfx/raylitfx.cpp
@@ -86,7 +86,7 @@ void BaseRaylitFx::doDryCompute(TRectD &rect,
if (bboxIn == TConsts::infiniteRectD)
bboxIn = rect;
- TDimension sizeIn(tmax(tceil(bboxIn.getLx()), 1), tmax(tceil(bboxIn.getLy()), 1));
+ TDimension sizeIn(std::max(tceil(bboxIn.getLx()), 1), std::max(tceil(bboxIn.getLy()), 1));
bboxIn = TRectD(bboxIn.getP00(), TDimensionD(sizeIn.lx, sizeIn.ly));
m_input->dryCompute(bboxIn, frame, ri);
}
@@ -151,7 +151,7 @@ void RaylitFx::doCompute(TTile &tileOut, double frame, const TRenderSettings &ri
TPoint posIn, posOut;
TTile tileIn;
- TDimension sizeIn(tmax(tceil(bboxIn.getLx()), 1), tmax(tceil(bboxIn.getLy()), 1));
+ TDimension sizeIn(std::max(tceil(bboxIn.getLx()), 1), std::max(tceil(bboxIn.getLy()), 1));
m_input->allocateAndCompute(tileIn, bboxIn.getP00(), sizeIn,
tileOut.getRaster(), frame, ri);
@@ -211,7 +211,7 @@ void ColorRaylitFx::doCompute(TTile &tileOut, double frame, const TRenderSetting
TPoint posIn, posOut;
TTile tileIn;
- TDimension sizeIn(tmax(tceil(bboxIn.getLx()), 1), tmax(tceil(bboxIn.getLy()), 1));
+ TDimension sizeIn(std::max(tceil(bboxIn.getLx()), 1), std::max(tceil(bboxIn.getLy()), 1));
m_input->allocateAndCompute(tileIn, bboxIn.getP00(), sizeIn,
tileOut.getRaster(), frame, ri);
diff --git a/toonz/sources/stdfx/rgbkeyfx.cpp b/toonz/sources/stdfx/rgbkeyfx.cpp
index 1717adb5c..19e2713e6 100644
--- a/toonz/sources/stdfx/rgbkeyfx.cpp
+++ b/toonz/sources/stdfx/rgbkeyfx.cpp
@@ -109,12 +109,12 @@ void RGBKeyFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
const TPixel32 Color = m_color->getPremultipliedValue(frame);
TRaster32P raster32 = tile.getRaster();
- int lowR = tmax(0, Color.r - r_range);
- int highR = tmin(255, Color.r + r_range);
- int lowG = tmax(0, Color.g - g_range);
- int highG = tmin(255, Color.g + g_range);
- int lowB = tmax(0, Color.b - b_range);
- int highB = tmin(255, Color.b + b_range);
+ int lowR = std::max(0, Color.r - r_range);
+ int highR = std::min(255, Color.r + r_range);
+ int lowG = std::max(0, Color.g - g_range);
+ int highG = std::min(255, Color.g + g_range);
+ int lowB = std::max(0, Color.b - b_range);
+ int highB = std::min(255, Color.b + b_range);
if (raster32)
doRGBKey<TPixel32, UCHAR>(raster32, highR, highG, highB, lowR, lowG, lowB, gender);
diff --git a/toonz/sources/stdfx/ripplefx.cpp b/toonz/sources/stdfx/ripplefx.cpp
index 9f37a6ad6..0bf8ca5a9 100644
--- a/toonz/sources/stdfx/ripplefx.cpp
+++ b/toonz/sources/stdfx/ripplefx.cpp
@@ -267,7 +267,7 @@ public:
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
- return tmax(
+ return std::max(
TRasterFx::memorySize(warpedComputeRect, info.m_bpp),
TRasterFx::memorySize(warperComputeRect, info.m_bpp));
}
diff --git a/toonz/sources/stdfx/rotationalblurfx.cpp b/toonz/sources/stdfx/rotationalblurfx.cpp
index c12952133..b3595112b 100644
--- a/toonz/sources/stdfx/rotationalblurfx.cpp
+++ b/toonz/sources/stdfx/rotationalblurfx.cpp
@@ -49,7 +49,7 @@ public:
double d2 = p2.x * p2.x + p2.y * p2.y;
double d3 = p3.x * p3.x + p3.y * p3.y;
double d4 = p4.x * p4.x + p4.y * p4.y;
- double maxD = tmax(tmax(tmax(d3, d4), d2), d1);
+ double maxD = std::max(std::max(std::max(d3, d4), d2), d1);
double dist = sqrt(maxD);
double blurangle;
if (dist > radius)
diff --git a/toonz/sources/stdfx/shaderfx.cpp b/toonz/sources/stdfx/shaderfx.cpp
index 05b1e68c6..540570094 100644
--- a/toonz/sources/stdfx/shaderfx.cpp
+++ b/toonz/sources/stdfx/shaderfx.cpp
@@ -946,7 +946,7 @@ void ShaderFx::doCompute(TTile &tile, double frame, const TRenderSettings &info)
if (currentSize.lx < size.lx || currentSize.ly < size.ly ||
currentFmt != fmt)
- context.resize(tmax(size.lx, currentSize.lx), tmax(size.ly, currentSize.ly), fmt);
+ context.resize(std::max(size.lx, currentSize.lx), std::max(size.ly, currentSize.ly), fmt);
}
}; // locals
diff --git a/toonz/sources/stdfx/sharpenfx.cpp b/toonz/sources/stdfx/sharpenfx.cpp
index 6315a6749..28c6ee5b0 100644
--- a/toonz/sources/stdfx/sharpenfx.cpp
+++ b/toonz/sources/stdfx/sharpenfx.cpp
@@ -33,8 +33,8 @@ void ropSharpen(const TRasterPT<T> &rin, TRasterPT<T> &rout, int sharpen_max_cor
rout->lock();
bufin = (T *)rin->getRawData();
bufout = (T *)rout->getRawData();
- lx = tmin(rin->getLx(), rout->getLx());
- ly = tmin(rin->getLy(), rout->getLy());
+ lx = std::min(rin->getLx(), rout->getLx());
+ ly = std::min(rin->getLy(), rout->getLy());
wrapin = rin->getWrap();
wrapout = rout->getWrap();
int maxChanVal = T::maxChannelValue;
diff --git a/toonz/sources/stdfx/warpfx.cpp b/toonz/sources/stdfx/warpfx.cpp
index 9c418cf59..4bd18d5b9 100644
--- a/toonz/sources/stdfx/warpfx.cpp
+++ b/toonz/sources/stdfx/warpfx.cpp
@@ -231,7 +231,7 @@ public:
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
- return tmax(
+ return std::max(
TRasterFx::memorySize(warpedComputeRect, info.m_bpp),
TRasterFx::memorySize(warperComputeRect, info.m_bpp));
}
diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp
index 899413a4e..c9bea2814 100644
--- a/toonz/sources/tcomposer/tcomposer.cpp
+++ b/toonz/sources/tcomposer/tcomposer.cpp
@@ -626,12 +626,6 @@ int main(int argc, char *argv[])
QFileInfo infoStuff(QString("Toonz 7.1 stuff"));
TFilePath stuffDirPath(infoStuff.absoluteFilePath().toStdString());
TEnv::setStuffDir(stuffDirPath);
-
-/*
- TFilePath stuffDir("/Applications/Toonz 7.1/Toonz 7.1 stuff");
- TEnv::setStuffDir(stuffDir);
-*/
-
#endif
// controllo se la xxxroot e' definita e corrisponde ad un file esistente
@@ -646,60 +640,6 @@ int main(int argc, char *argv[])
m_userLog = new TUserLogAppend(logFilePath);
string msg;
- /*
-
- #ifdef MACOSX
- // Library and cacheRoot Folders
-
- TFilePath libraryFolder =
- setToonzFolder(
- TEnv::getStuffDir() + "toonzenv.txt",
- TEnv::getSystemVarPrefix() +"LIBRARY");
- if(libraryFolder == TFilePath())
- {
- cout << "Cannot set " << TEnv::getSystemVarPrefix() << "LIBRARY folder" << endl;
- m_userLog->error("Cannot set " +TEnv::getSystemVarPrefix()+"LIBRARY folder");
- return -1;
- }
- TFilePath cacheRoot =
- setToonzFolder(
- TEnv::getStuffDir() + "toonzenv.txt",
- TEnv::getSystemVarPrefix()+"CACHEROOT");
- if(cacheRoot == TFilePath())
- {
- cout << "Cannot set " + TEnv::getSystemVarPrefix() +"CACHEROOT folder" << endl;
- m_userLog->error("Cannot set " + TEnv::getSystemVarPrefix() + "CACHEROOT folder");
- return -1;
- }
-*/
- /*
- TFilePath libraryFolder("/Applications/Toonz 5.0/Toonz 5.0 stuff/projects/library");
- TFilePath cacheRoot("/Applications/Toonz 5.0/Toonz 5.0 stuff/cache");
-*/
- /*
- TRasterImagePatternStrokeStyle::setRootDir(libraryFolder);
- TVectorImagePatternStrokeStyle::setRootDir(libraryFolder);
- TPalette::setRootDir(libraryFolder);
- cacheRoot += TFilePath(toString(TSystem::getProcessId()));
- TFileStatus fs(cacheRoot);
- if (!fs.doesExist())
- TSystem::mkDir(cacheRoot);
- TImageCache::instance()->setRootDir(cacheRoot);
-
- // ProjectFolder
- TFilePath projectFolder = setToonzFolder(TEnv::getStuffDir() + "toonzenv.txt", TEnv::getSystemVarPrefix()+"PROJECTS");
-
- if(projectFolder == TFilePath())
- {
- cout << "Cannot set TOONZPROJECTS folder" << endl;
- m_userLog->error("Cannot set TOONZPROJECTS folder");
- return -1;
- }
-
- TProjectManager::instance()->addProjectsRoot(projectFolder);
- #else
-*/
-
// Initialize measure units
Preferences::instance(); // Loads standard (linear) units
TMeasureManager::instance()-> // Loads camera-related units
@@ -768,19 +708,6 @@ int main(int argc, char *argv[])
try {
Tiio::defineStd();
- //#ifdef MACOSX
- // LoadStandardPlugins ha bisogno di BINROOT definita
- // non potendola memorizzare su TSystem (non ci sono setter)
- // mi prendo il suo valore da toonzenv.txt e carico direttamente
- // i plugins scolpendo le directory mancanti
-
- // TFilePath binRoot = setToonzFolder(TEnv::getStuffDir() + "toonzenv.txt","BINROOT");
-
- // TPluginManager::instance()->loadPlugins(binRoot + "bin" + "plugins" + "io");
- // TPluginManager::instance()->loadPlugins(binRoot + "bin" + "plugins" + "fx");
- //#else
- // TPluginManager::instance()->loadStandardPlugins();//per ora , visto che altrimenti non funzionano gli stili speciali
-
initImageIo();
Tiio::defineStd();
initSoundIo();
diff --git a/toonz/sources/tnzbase/trasterfx.cpp b/toonz/sources/tnzbase/trasterfx.cpp
index 74998a03f..8c17095ab 100644
--- a/toonz/sources/tnzbase/trasterfx.cpp
+++ b/toonz/sources/tnzbase/trasterfx.cpp
@@ -106,7 +106,7 @@ double norm2(const TAffine &aff)
double eig1 = a11plusa22 + delta;
double eig2 = a11plusa22 - delta;
- return tmax(sqrt(eig1 / 2.0), sqrt(eig2 / 2.0));
+ return std::max(sqrt(eig1 / 2.0), sqrt(eig2 / 2.0));
}
//--------------------------------------------------
diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
index 3cc292ce0..ec7835d8a 100644
--- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
+++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
@@ -59,7 +59,7 @@ void buf2printable(const unsigned char *buffer, const int size, ostrstream &os)
return;
}
os << std::hex;
- for (; i < tmin(size, 0x40); ++i) {
+ for (; i < std::min(size, 0x40); ++i) {
char c = buffer[i];
os << "0x" << (unsigned int)c << " ";
}
diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
index 5fbc8223f..6014d14b0 100644
--- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
+++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
@@ -30,7 +30,7 @@ void buf2printable(const unsigned char *buffer, const int size, std::ostrstream
return;
}
os << std::hex;
- for (; i < tmin(size, 0x40); ++i) {
+ for (; i < std::min(size, 0x40); ++i) {
char c = buffer[i];
os << "0x" << (unsigned int)c << " ";
}
diff --git a/toonz/sources/tnzext/meshbuilder.cpp b/toonz/sources/tnzext/meshbuilder.cpp
index 35f32e52e..c30773709 100644
--- a/toonz/sources/tnzext/meshbuilder.cpp
+++ b/toonz/sources/tnzext/meshbuilder.cpp
@@ -455,7 +455,7 @@ TMeshImageP buildMesh(const TRasterP &ras, const MeshBuilderOptions &options)
double minEdgeLength = buildMinimumEdgeLength(tribe, options.m_targetMaxVerticesCount);
MeshBuilderOptions opts(options);
- opts.m_targetEdgeLength = tmax(opts.m_targetEdgeLength, minEdgeLength);
+ opts.m_targetEdgeLength = std::max(opts.m_targetEdgeLength, minEdgeLength);
// Perform tessellation
TMeshImageP meshImage(new TMeshImage);
diff --git a/toonz/sources/tnzext/meshtexturizer.cpp b/toonz/sources/tnzext/meshtexturizer.cpp
index 16f85577c..996586332 100644
--- a/toonz/sources/tnzext/meshtexturizer.cpp
+++ b/toonz/sources/tnzext/meshtexturizer.cpp
@@ -235,8 +235,8 @@ int MeshTexturizer::bindTexture(const TRaster32P &ras, const TRectD &geom,
int textureLy = tcg::numeric_ops::GE_2Power((unsigned int)ras->getLy() + TOTAL_BORDER_2);
// We'll assume a strict granularity max of 512 x 512 textures
- textureLx = tmin(textureLx, 1 << 9);
- textureLy = tmin(textureLy, 1 << 9);
+ textureLx = std::min(textureLx, 1 << 9);
+ textureLy = std::min(textureLy, 1 << 9);
// Allocate a suitable texture raster. The texture will include a transparent 1-pix border
// that is needed to perform texture mapping with GL_CLAMP transparent wrapping
diff --git a/toonz/sources/tnzext/meshutils.cpp b/toonz/sources/tnzext/meshutils.cpp
index 4580bf25a..cf5f2e8e0 100644
--- a/toonz/sources/tnzext/meshutils.cpp
+++ b/toonz/sources/tnzext/meshutils.cpp
@@ -403,10 +403,11 @@ void tglDraw(const TMeshImage &meshImage,
TPointD s[3] = {tileAff[t] * p0, tileAff[t] * p1, tileAff[t] * p2};
// Test the face bbox - tile intersection
- if (tmin(s[0].x, s[1].x, s[2].x) > 1.0 ||
- tmin(s[0].y, s[1].y, s[2].y) > 1.0 ||
- tmax(s[0].x, s[1].x, s[2].x) < 0.0 ||
- tmax(s[0].y, s[1].y, s[2].y) < 0.0)
+ if (
+ std::min({s[0].x, s[1].x, s[2].x}) > 1.0 ||
+ std::min({s[0].y, s[1].y, s[2].y}) > 1.0 ||
+ std::max({s[0].x, s[1].x, s[2].x}) < 0.0 ||
+ std::max({s[0].y, s[1].y, s[2].y}) < 0.0)
continue;
// If the tile has changed, interrupt the glBegin/glEnd block and bind the
diff --git a/toonz/sources/tnzext/plasticdeformer.cpp b/toonz/sources/tnzext/plasticdeformer.cpp
index 8e6ed2975..9c6a97457 100644
--- a/toonz/sources/tnzext/plasticdeformer.cpp
+++ b/toonz/sources/tnzext/plasticdeformer.cpp
@@ -734,14 +734,14 @@ void PlasticDeformer::Imp::deformStep2(const TPointD *dstHandles, double *dstVer
fitTri[2] = scale * (fitTri[2] - baricenter) + baricenter;
// Build f -- note: this should be part of step 3, we're just avoiding the same cycle twice :)
- add_f_values(v0, v1, fitTri[0].x, fitTri[1].x, tmin(p0.rigidity, p1.rigidity), m_fx.get());
- add_f_values(v0, v1, fitTri[0].y, fitTri[1].y, tmin(p0.rigidity, p1.rigidity), m_fy.get());
+ add_f_values(v0, v1, fitTri[0].x, fitTri[1].x, std::min(p0.rigidity, p1.rigidity), m_fx.get());
+ add_f_values(v0, v1, fitTri[0].y, fitTri[1].y, std::min(p0.rigidity, p1.rigidity), m_fy.get());
- add_f_values(v1, v2, fitTri[1].x, fitTri[2].x, tmin(p1.rigidity, p2.rigidity), m_fx.get());
- add_f_values(v1, v2, fitTri[1].y, fitTri[2].y, tmin(p1.rigidity, p2.rigidity), m_fy.get());
+ add_f_values(v1, v2, fitTri[1].x, fitTri[2].x, std::min(p1.rigidity, p2.rigidity), m_fx.get());
+ add_f_values(v1, v2, fitTri[1].y, fitTri[2].y, std::min(p1.rigidity, p2.rigidity), m_fy.get());
- add_f_values(v2, v0, fitTri[2].x, fitTri[0].x, tmin(p2.rigidity, p0.rigidity), m_fx.get());
- add_f_values(v2, v0, fitTri[2].y, fitTri[0].y, tmin(p2.rigidity, p0.rigidity), m_fy.get());
+ add_f_values(v2, v0, fitTri[2].x, fitTri[0].x, std::min(p2.rigidity, p0.rigidity), m_fx.get());
+ add_f_values(v2, v0, fitTri[2].y, fitTri[0].y, std::min(p2.rigidity, p0.rigidity), m_fy.get());
}
#ifdef GL_DEBUG
@@ -784,9 +784,9 @@ void PlasticDeformer::Imp::initializeStep3()
&p1 = mesh.vertex(v1).P(),
&p2 = mesh.vertex(v2).P();
- addHValues(v0, v1, tmin(p0.rigidity, p1.rigidity), m_H);
- addHValues(v1, v2, tmin(p1.rigidity, p2.rigidity), m_H);
- addHValues(v2, v0, tmin(p2.rigidity, p0.rigidity), m_H);
+ addHValues(v0, v1, std::min(p0.rigidity, p1.rigidity), m_H);
+ addHValues(v1, v2, std::min(p1.rigidity, p2.rigidity), m_H);
+ addHValues(v2, v0, std::min(p2.rigidity, p0.rigidity), m_H);
}
}
diff --git a/toonz/sources/tnzext/plasticdeformerstorage.cpp b/toonz/sources/tnzext/plasticdeformerstorage.cpp
index 0bd89810b..5420d3580 100644
--- a/toonz/sources/tnzext/plasticdeformerstorage.cpp
+++ b/toonz/sources/tnzext/plasticdeformerstorage.cpp
@@ -248,8 +248,8 @@ bool updateHandlesSO(DataGroup *group, const SkD *sd, int skelId, double frame)
for (h = 0; h != hCount; ++h) {
const double &so = group->m_handles[h].m_so;
- group->m_soMin = tmin(group->m_soMin, so);
- group->m_soMax = tmax(group->m_soMax, so);
+ group->m_soMin = std::min(group->m_soMin, so);
+ group->m_soMax = std::max(group->m_soMax, so);
}
}
diff --git a/toonz/sources/tnzext/plastichandle.cpp b/toonz/sources/tnzext/plastichandle.cpp
index 46351a143..455ae8d7b 100644
--- a/toonz/sources/tnzext/plastichandle.cpp
+++ b/toonz/sources/tnzext/plastichandle.cpp
@@ -149,7 +149,7 @@ void buildSO(double *so, const TTextureMesh &mesh,
// Build the interpolant function data
const TRectD &bbox = mesh.getBBox();
- const double len = tmax(bbox.getLx(), bbox.getLy()), val = 1e-8;
+ const double len = std::max(bbox.getLx(), bbox.getLy()), val = 1e-8;
const double k = -log(val) / len;
// Allocate / initialize arrays
diff --git a/toonz/sources/tnztools/autofilltlv.cpp b/toonz/sources/tnztools/autofilltlv.cpp
index 45d992921..36d8fae1a 100644
--- a/toonz/sources/tnztools/autofilltlv.cpp
+++ b/toonz/sources/tnztools/autofilltlv.cpp
@@ -581,7 +581,7 @@ static void scan_fabri_regions(TRasterCM32P ras, struct s_fabri_region_list *rls
if (region_id < 0) {
region_id = region_old;
rlst->array[region_id].per += 2 * (xb - xa + 1) + 2 -
- 2 * (MIN(row[rold][j].xb, xb) - MAX(row[rold][j].xa, xa) + 1);
+ 2 * (std::min(row[rold][j].xb, xb) - std::max(row[rold][j].xa, xa) + 1);
} else if (region_id != region_old) {
/* CONTATTO FRA region_id E region_old */
PRINTF("Contatto tra %d e %d \n", region_id, region_old);
@@ -605,7 +605,7 @@ static void scan_fabri_regions(TRasterCM32P ras, struct s_fabri_region_list *rls
rlst->array[keep].holes += rlst->array[discard].holes;
rlst->array[keep].npix += rlst->array[discard].npix;
rlst->array[keep].per += rlst->array[discard].per -
- 2 * (MIN(row[rold][j].xb, xb) - MAX(row[rold][j].xa, xa) + 1);
+ 2 * (std::min(row[rold][j].xb, xb) - std::max(row[rold][j].xa, xa) + 1);
fondi(rlst, keep, discard);
@@ -1003,7 +1003,7 @@ static void assign_prob3(int prob[], int i, int j)
(delta_pos / delta_pos_max)));
delta_pix = abs(F_reference.array[i].npix - F_work.array[j].npix);
- delta_pix_max = MAX((F_work.lx * F_work.ly), (F_reference.lx * F_reference.ly));
+ delta_pix_max = std::max((F_work.lx * F_work.ly), (F_reference.lx * F_reference.ly));
prob[(F_work.n * F_reference.n) + i + (j * F_reference.n)] =
ROUNDP(1000 * (1 - ((double)delta_pix /
@@ -1113,7 +1113,7 @@ static int somma_quadrati(int x, int y)
int somma = 0;
int i;
- for (i = MIN(x, y); i <= MAX(x, y); i++)
+ for (i = std::min(x, y); i <= std::max(x, y); i++)
somma += i * i;
return somma;
}
diff --git a/toonz/sources/tnztools/bendertool.cpp b/toonz/sources/tnztools/bendertool.cpp
index 660cc74fc..5ad9ed75e 100644
--- a/toonz/sources/tnztools/bendertool.cpp
+++ b/toonz/sources/tnztools/bendertool.cpp
@@ -538,10 +538,10 @@ void BenderTool::findCurves(TVectorImageP &vi)
TPointD bboxP0 = bbox.getP00();
TPointD bboxP1 = bbox.getP11();
- double bboxX0 = tmin(bboxP0.x, bboxP1.x);
- double bboxX1 = tmax(bboxP0.x, bboxP1.x);
- double bboxY0 = tmin(bboxP0.y, bboxP1.y);
- double bboxY1 = tmax(bboxP0.y, bboxP1.y);
+ double bboxX0 = std::min(bboxP0.x, bboxP1.x);
+ double bboxX1 = std::max(bboxP0.x, bboxP1.x);
+ double bboxY0 = std::min(bboxP0.y, bboxP1.y);
+ double bboxY1 = std::max(bboxP0.y, bboxP1.y);
TSegment segment;
TPointD pp0 = m_benderSegment.getP0();
@@ -565,7 +565,7 @@ void BenderTool::findCurves(TVectorImageP &vi)
else if (pp1.y == pp0.y)
t = (x - pp0.x) / (pp1.x - pp0.x);
else
- t = tmin((x - pp0.x) / (pp1.x - pp0.x), (y - pp0.y) / (pp1.y - pp0.y));
+ t = std::min((x - pp0.x) / (pp1.x - pp0.x), (y - pp0.y) / (pp1.y - pp0.y));
newP1 = (t > 1) ? m_benderSegment.getPoint(t + littleBit) : pp1;
} else
@@ -586,7 +586,7 @@ void BenderTool::findCurves(TVectorImageP &vi)
else if (pp1.y == pp0.y)
t = (x - pp0.x) / (pp1.x - pp0.x);
else
- t = tmax((x - pp0.x) / (pp1.x - pp0.x), (y - pp0.y) / (pp1.y - pp0.y));
+ t = std::max((x - pp0.x) / (pp1.x - pp0.x), (y - pp0.y) / (pp1.y - pp0.y));
newP0 = (t < 0) ? m_benderSegment.getPoint(t - littleBit) : pp0;
} else
diff --git a/toonz/sources/tnztools/bluredbrush.cpp b/toonz/sources/tnztools/bluredbrush.cpp
index 19d4efa16..aea7f03a7 100644
--- a/toonz/sources/tnztools/bluredbrush.cpp
+++ b/toonz/sources/tnztools/bluredbrush.cpp
@@ -48,7 +48,7 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId, b
bool sameStyleId = styleId == outPix->getInk();
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255 : outPix->getTone();
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m ? outPix->getInk() : styleId;
- *outPix = TPixelCM32(ink, outPix->getPaint(), tmin(255 - inPix->m, tone));
+ *outPix = TPixelCM32(ink, outPix->getPaint(), std::min(255 - inPix->m, tone));
}
}
} else {
@@ -67,7 +67,7 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId, b
bool sameStyleId = styleId == outPix->getInk();
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255 : outPix->getTone();
int ink = outPix->getTone() < 255 && !sameStyleId && outPix->getTone() <= 255 - inPix->m ? outPix->getInk() : styleId;
- *outPix = TPixelCM32(ink, outPix->getPaint(), tmin(255 - inPix->m, tone));
+ *outPix = TPixelCM32(ink, outPix->getPaint(), std::min(255 - inPix->m, tone));
}
}
}
@@ -98,7 +98,7 @@ void eraseFromRasterCM(const TRasterCM32P &out, const TRaster32P &in,
bool eraseInk = !selective || (selective && selectedStyleId == outPix->getInk());
bool erasePaint = !selective || (selective && selectedStyleId == outPix->getPaint());
int paint = eraseAreas && erasePaint ? 0 : outPix->getPaint();
- int tone = inPix->m > 0 && eraseLine && eraseInk ? tmax(outPix->getTone(), (int)inPix->m) : outPix->getTone();
+ int tone = inPix->m > 0 && eraseLine && eraseInk ? std::max(outPix->getTone(), (int)inPix->m) : outPix->getTone();
*outPix = TPixelCM32(outPix->getInk(), paint, tone);
}
}
diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp
index 3fed6a626..d6f2c1472 100644
--- a/toonz/sources/tnztools/brushtool.cpp
+++ b/toonz/sources/tnztools/brushtool.cpp
@@ -290,7 +290,7 @@ void findMaxCurvPoints(
t_ext = 0;
else
t_ext = 1;
- double maxEstremi = tmax(estremo_dx, estremo_sx);
+ double maxEstremi = std::max(estremo_dx, estremo_sx);
if (maxEstremi > estremo_int) {
t = t_ext;
curv_max = maxEstremi;
@@ -1495,7 +1495,7 @@ void BrushTool::loadPreset()
m_joinStyle.setIndex(preset.m_join);
m_miterJoinLimit.setValue(preset.m_miter);
} else {
- m_rasThickness.setValue(TDoublePairProperty::Value(tmax(preset.m_min, 1.0), preset.m_max));
+ m_rasThickness.setValue(TDoublePairProperty::Value(std::max(preset.m_min, 1.0), preset.m_max));
m_brushPad = ToolUtils::getBrushPad(preset.m_max, preset.m_hardness * 0.01);
m_hardness.setValue(preset.m_hardness, true);
m_selective.setValue(preset.m_selective);
diff --git a/toonz/sources/tnztools/controlpointselection.cpp b/toonz/sources/tnztools/controlpointselection.cpp
index 66c9e96b6..0fa650c76 100644
--- a/toonz/sources/tnztools/controlpointselection.cpp
+++ b/toonz/sources/tnztools/controlpointselection.cpp
@@ -914,9 +914,9 @@ ControlPointEditorStroke::PointType ControlPointEditorStroke::getPointTypeAt(con
double distanceIn2 = !isSpeedInLinear(i) ? tdistance2(pos, point - cPoint.m_speedIn) : cpDistance2 + 1;
double distanceOut2 = !isSpeedOutLinear(i) ? tdistance2(pos, point + cPoint.m_speedOut) : cpDistance2 + 1;
if (i == 0 && !isSelfLoop())
- distanceIn2 = tmax(cpDistance2, distanceOut2) + 1;
+ distanceIn2 = std::max(cpDistance2, distanceOut2) + 1;
if (i == cpCount - 1 && !isSelfLoop())
- distanceOut2 = tmax(cpDistance2, distanceIn2) + 1;
+ distanceOut2 = std::max(cpDistance2, distanceIn2) + 1;
if (cpDistance2 < distanceIn2 && cpDistance2 < distanceOut2 && (cpDistance2 < minDistance2 || index < 0)) {
minDistance2 = cpDistance2;
diff --git a/toonz/sources/tnztools/edittoolgadgets.cpp b/toonz/sources/tnztools/edittoolgadgets.cpp
index 473b2b3f0..161352ab1 100644
--- a/toonz/sources/tnztools/edittoolgadgets.cpp
+++ b/toonz/sources/tnztools/edittoolgadgets.cpp
@@ -711,9 +711,9 @@ void SizeFxGadget::draw(bool picking)
void SizeFxGadget::leftButtonDrag(const TPointD &pos, const TMouseEvent &)
{
if (m_ly)
- setValue(m_lx, tmax(pos.x, 0.1)), setValue(m_ly, tmax(pos.y, 0.1));
+ setValue(m_lx, std::max(pos.x, 0.1)), setValue(m_ly, std::max(pos.y, 0.1));
else
- setValue(m_lx, tmax(pos.x, pos.y, 0.1));
+ setValue(m_lx, std::max({pos.x, pos.y, 0.1}));
}
//=============================================================================
diff --git a/toonz/sources/tnztools/filltool.cpp b/toonz/sources/tnztools/filltool.cpp
index bb36a7e70..0c676e838 100644
--- a/toonz/sources/tnztools/filltool.cpp
+++ b/toonz/sources/tnztools/filltool.cpp
@@ -1726,8 +1726,8 @@ public:
{
double k = dy / dx; /*-- 直線の傾き --*/
/*--- roundでは負値のときにうまく繋がらない ---*/
- int start = tmin((int)floor(m_startPosition.x + 0.5), (int)floor(m_mousePosition.x + 0.5));
- int end = tmax((int)floor(m_startPosition.x + 0.5), (int)floor(m_mousePosition.x + 0.5));
+ int start = std::min((int)floor(m_startPosition.x + 0.5), (int)floor(m_mousePosition.x + 0.5));
+ int end = std::max((int)floor(m_startPosition.x + 0.5), (int)floor(m_mousePosition.x + 0.5));
double start_x = (m_startPosition.x < m_mousePosition.x) ? m_startPosition.x : m_mousePosition.x;
double start_y = (m_startPosition.x < m_mousePosition.x) ? m_startPosition.y : m_mousePosition.y;
for (int x = start; x <= end; x++) {
@@ -1745,8 +1745,8 @@ public:
{
double k = dx / dy; /*-- 直線の傾き --*/
/*--- roundでは負値のときにうまく繋がらない ---*/
- int start = tmin((int)floor(m_startPosition.y + 0.5), (int)floor(m_mousePosition.y + 0.5));
- int end = tmax((int)floor(m_startPosition.y + 0.5), (int)floor(m_mousePosition.y + 0.5));
+ int start = std::min((int)floor(m_startPosition.y + 0.5), (int)floor(m_mousePosition.y + 0.5));
+ int end = std::max((int)floor(m_startPosition.y + 0.5), (int)floor(m_mousePosition.y + 0.5));
double start_x = (m_startPosition.y < m_mousePosition.y) ? m_startPosition.x : m_mousePosition.x;
double start_y = (m_startPosition.y < m_mousePosition.y) ? m_startPosition.y : m_mousePosition.y;
for (int y = start; y <= end; y++) {
diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp
index 8033985bd..32dc43a97 100644
--- a/toonz/sources/tnztools/fullcolorbrushtool.cpp
+++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp
@@ -641,7 +641,7 @@ void FullColorBrushTool::loadPreset()
try //Don't bother with RangeErrors
{
- m_thickness.setValue(TIntPairProperty::Value(tmax((int)preset.m_min, 1), preset.m_max));
+ m_thickness.setValue(TIntPairProperty::Value(std::max((int)preset.m_min, 1), preset.m_max));
m_brushPad = ToolUtils::getBrushPad(preset.m_max, preset.m_hardness * 0.01);
m_hardness.setValue(preset.m_hardness, true);
m_opacity.setValue(TDoublePairProperty::Value(preset.m_opacityMin, preset.m_opacityMax));
diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp
index 3b8fc3ed8..7052e3cb8 100644
--- a/toonz/sources/tnztools/geometrictool.cpp
+++ b/toonz/sources/tnztools/geometrictool.cpp
@@ -1153,10 +1153,10 @@ TStroke *RectanglePrimitive::makeStroke() const
return 0;
TRectD selArea;
- selArea.x0 = tmin(m_selectingRect.x0, m_selectingRect.x1);
- selArea.y0 = tmin(m_selectingRect.y0, m_selectingRect.y1);
- selArea.x1 = tmax(m_selectingRect.x0, m_selectingRect.x1);
- selArea.y1 = tmax(m_selectingRect.y0, m_selectingRect.y1);
+ selArea.x0 = std::min(m_selectingRect.x0, m_selectingRect.x1);
+ selArea.y0 = std::min(m_selectingRect.y0, m_selectingRect.y1);
+ selArea.x1 = std::max(m_selectingRect.x0, m_selectingRect.x1);
+ selArea.y1 = std::max(m_selectingRect.y0, m_selectingRect.y1);
double thick = getThickness();
diff --git a/toonz/sources/tnztools/imagegrouping.cpp b/toonz/sources/tnztools/imagegrouping.cpp
index 973b8cb3e..c92be17cd 100644
--- a/toonz/sources/tnztools/imagegrouping.cpp
+++ b/toonz/sources/tnztools/imagegrouping.cpp
@@ -621,7 +621,7 @@ int commonDepth(TVectorImage *vimg, int index1, int count, int index2)
{
int i, ret = 1000;
for (i = index1; i < index1 + count; i++)
- ret = tmin(ret, vimg->getCommonGroupDepth(i, index2));
+ ret = std::min(ret, vimg->getCommonGroupDepth(i, index2));
return ret;
}
diff --git a/toonz/sources/tnztools/irontool.cpp b/toonz/sources/tnztools/irontool.cpp
index cf8cf6cb8..9d91ab550 100644
--- a/toonz/sources/tnztools/irontool.cpp
+++ b/toonz/sources/tnztools/irontool.cpp
@@ -142,8 +142,8 @@ public:
m_range.second = m_strokeRef->getW(pos);
m_cursor = m_strokeRef->getThickPoint(m_range.second);
- double v0 = tmin(m_range.first, m_range.second);
- double v1 = tmax(m_range.first, m_range.second);
+ double v0 = std::min(m_range.first, m_range.second);
+ double v1 = std::max(m_range.first, m_range.second);
const double eps = 0.005;
if (v1 - v0 < eps && !(m_strokeRef->isSelfLoop() && 1 - (v1 - v0) < eps)) {
diff --git a/toonz/sources/tnztools/plastictool.cpp b/toonz/sources/tnztools/plastictool.cpp
index da9f5791a..275e28e93 100644
--- a/toonz/sources/tnztools/plastictool.cpp
+++ b/toonz/sources/tnztools/plastictool.cpp
@@ -1909,7 +1909,7 @@ void PlasticTool::drawOnionSkinSkeletons_build(double pixelSize)
UCHAR &skelAlpha = skelAlphas[skelId];
UCHAR alpha = 255 - UCHAR(255.0 * OnionSkinMask::getOnionSkinFade(osRows[r] - currentRow));
- skelAlpha = tmax(skelAlpha, alpha);
+ skelAlpha = std::max(skelAlpha, alpha);
}
std::map<int, UCHAR>::iterator st, sEnd(skelAlphas.end());
@@ -1959,7 +1959,7 @@ void PlasticTool::drawAngleLimits(const SkDP &sd, int skelId, int v, double pixe
void drawAnnulusArc(const TPointD &center, double angleStart, double angleEnd,
double radiusA, double radiusB, double pixelSize)
{
- double angleDelta = acos(1.0 - pixelSize / tmax(radiusA, radiusB)) *
+ double angleDelta = acos(1.0 - pixelSize / std::max(radiusA, radiusB)) *
((angleStart <= angleEnd) ? 1.0 : -1.0);
int a, aCount = tcg::numeric_ops::grow(fabs((angleEnd - angleStart) / angleDelta));
diff --git a/toonz/sources/tnztools/plastictool_build.cpp b/toonz/sources/tnztools/plastictool_build.cpp
index 45e3db00d..8780aa99c 100644
--- a/toonz/sources/tnztools/plastictool_build.cpp
+++ b/toonz/sources/tnztools/plastictool_build.cpp
@@ -56,7 +56,7 @@ TPointD closestMeshVertexPos(const TPointD &pos, double *distance = 0)
const TPointD &vxPos_mesh = mi->meshes()[closest.second.m_meshIdx]->vertex(closest.second.m_idx).P();
if (distance)
- *distance = tmin(Stage::inch / dpi.x, Stage::inch / dpi.y) * closest.first;
+ *distance = std::min(Stage::inch / dpi.x, Stage::inch / dpi.y) * closest.first;
// Cast it back to world coordinates
return TPointD(vxPos_mesh.x * (Stage::inch / dpi.x), vxPos_mesh.y * (Stage::inch / dpi.y));
diff --git a/toonz/sources/tnztools/pumptool.cpp b/toonz/sources/tnztools/pumptool.cpp
index fb842f2a4..ddd307c93 100644
--- a/toonz/sources/tnztools/pumptool.cpp
+++ b/toonz/sources/tnztools/pumptool.cpp
@@ -555,7 +555,7 @@ void PumpTool::onLeave()
double PumpTool::actionRadius(double strokeLength)
{
- double toolSize = tmax(m_toolSize.getValue(), 5.0);
+ double toolSize = std::max(m_toolSize.getValue(), 5.0);
double toolPercent = toolSize * 0.01;
double interpolationVal = pow(toolPercent, 5);
double indipendentValue = 7.0 * toolSize;
@@ -563,7 +563,7 @@ double PumpTool::actionRadius(double strokeLength)
double actionRadius = (indipendentValue) * (1.0 - interpolationVal) +
(strokeLength * toolPercent) * interpolationVal;
- return tmax(actionRadius, indipendentValue);
+ return std::max(actionRadius, indipendentValue);
}
//----------------------------------------------------------------------
@@ -611,8 +611,8 @@ void PumpTool::splitStroke(TStroke *s)
//Regular split positions, in the [0.0, totalLength] range.
//Split points at extremities are dealt.
- m_splitPars[0] = s->getParameterAtLength(tmax(startLen, 0.0)); //Crop in the open case
- m_splitPars[1] = s->getParameterAtLength(tmin(endLen, totalLength));
+ m_splitPars[0] = s->getParameterAtLength(std::max(startLen, 0.0)); //Crop in the open case
+ m_splitPars[1] = s->getParameterAtLength(std::min(endLen, totalLength));
if (m_splitPars[0] == 0.0) // the "&& m_splitPars[0] == totalLength" was dealt outside
{
diff --git a/toonz/sources/tnztools/rasterselection.cpp b/toonz/sources/tnztools/rasterselection.cpp
index cdc0c288b..bfb3e38aa 100644
--- a/toonz/sources/tnztools/rasterselection.cpp
+++ b/toonz/sources/tnztools/rasterselection.cpp
@@ -133,8 +133,8 @@ TRasterPT<PIXEL1> getImageFromStroke(TRasterPT<PIXEL2> ras, const TStroke &strok
for (j = 0; j < (int)intersections.size(); j += 2) {
if (intersections[j] == intersections[j + 1])
continue;
- int from = tmax(tfloor(intersections[j]), bBox.x0);
- int to = tmin(tceil(intersections[j + 1]), bBox.x1);
+ int from = std::max(tfloor(intersections[j]), bBox.x0);
+ int to = std::min(tceil(intersections[j + 1]), bBox.x1);
for (k = from; k <= to; k++) {
TRasterCM32P bufferCM(buffer);
TRaster32P buffer32(buffer);
@@ -188,7 +188,7 @@ TRasterPT<PIXEL1> getImageFromSelection(TRasterPT<PIXEL2> &ras, RasterSelection
TRect strokeRect(tfloor(strokeRectD.x0), tfloor(strokeRectD.y0), tceil(strokeRectD.x1) - 1, tceil(strokeRectD.y1) - 1);
TPoint offset((strokeRect * rSelectionBound).getP00() - rSelectionBound.getP00());
TPoint startP = rSelectionBound.getP00() + offset;
- startPosition = TPoint(tmin(startPosition.x, startP.x), tmin(startPosition.y, startP.y));
+ startPosition = TPoint(std::min(startPosition.x, startP.x), std::min(startPosition.y, startP.y));
TRop::over(selectedRaster, app, offset);
}
@@ -253,8 +253,8 @@ void deleteSelectionWithoutUndo(TRasterPT<PIXEL> &ras, const std::vector<TStroke
for (j = 0; j < (int)intersections.size(); j += 2) {
if (intersections[j] == intersections[j + 1])
continue;
- int from = tmax(tfloor(intersections[j]), bBox.x0);
- int to = tmin(tceil(intersections[j + 1]), bBox.x1);
+ int from = std::max(tfloor(intersections[j]), bBox.x0);
+ int to = std::min(tceil(intersections[j + 1]), bBox.x1);
for (k = from; k <= to; k++)
*(selectedLine + k) = emptyValue;
}
diff --git a/toonz/sources/tnztools/rasterselectiontool.cpp b/toonz/sources/tnztools/rasterselectiontool.cpp
index 4746fb849..719bcd118 100644
--- a/toonz/sources/tnztools/rasterselectiontool.cpp
+++ b/toonz/sources/tnztools/rasterselectiontool.cpp
@@ -62,10 +62,10 @@ void RasterFreeDeformer::deformImage()
TPointD p11 = m_newPoints[2] - m_newPoints[0];
TPointD p01 = m_newPoints[3] - m_newPoints[0];
- double x0 = tmin(p00.x, p10.x, p11.x, p01.x);
- double y0 = tmin(p00.y, p10.y, p11.y, p01.y);
- double x1 = tmax(p00.x, p10.x, p11.x, p01.x);
- double y1 = tmax(p00.y, p10.y, p11.y, p01.y);
+ double x0 = std::min({p00.x, p10.x, p11.x, p01.x});
+ double y0 = std::min({p00.y, p10.y, p11.y, p01.y});
+ double x1 = std::max({p00.x, p10.x, p11.x, p01.x});
+ double y1 = std::max({p00.y, p10.y, p11.y, p01.y});
TRectD sourceRect(TPointD(), TPointD(m_ras->getLx(), m_ras->getLy()));
BilinearDistorterBase dist(
@@ -629,8 +629,8 @@ void RasterSelectionTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &
else if (ri)
imageSize = ri->getRaster()->getSize();
TPointD p(imageSize.lx % 2 ? 0.5 : 0.0, imageSize.ly % 2 ? 0.5 : 0.0);
- TRectD rectD(tround(tmin(m_firstPos.x, pos.x) - p.x) + p.x, tround(tmin(m_firstPos.y, pos.y) - p.y) + p.y,
- tround(tmax(m_firstPos.x, pos.x) - p.x) + p.x, tround(tmax(m_firstPos.y, pos.y) - p.y) + p.y);
+ TRectD rectD(tround(std::min(m_firstPos.x, pos.x) - p.x) + p.x, tround(std::min(m_firstPos.y, pos.y) - p.y) + p.y,
+ tround(std::max(m_firstPos.x, pos.x) - p.x) + p.x, tround(std::max(m_firstPos.y, pos.y) - p.y) + p.y);
m_selectingRect = rectD;
m_bboxs.clear();
diff --git a/toonz/sources/tnztools/selectiontool.cpp b/toonz/sources/tnztools/selectiontool.cpp
index 9fffa49aa..64348c102 100644
--- a/toonz/sources/tnztools/selectiontool.cpp
+++ b/toonz/sources/tnztools/selectiontool.cpp
@@ -220,7 +220,7 @@ void DragSelectionTool::FourPoints::empty()
bool DragSelectionTool::FourPoints::contains(TPointD p)
{
- double maxDistance = tmax(tdistance2(getP00(), getP11()), tdistance2(getP10(), getP01()));
+ double maxDistance = std::max(tdistance2(getP00(), getP11()), tdistance2(getP10(), getP01()));
TPointD outP = p + maxDistance * TPointD(1, 1);
TSegment segment(outP, p);
std::vector<DoublePair> d;
@@ -235,10 +235,10 @@ bool DragSelectionTool::FourPoints::contains(TPointD p)
TRectD DragSelectionTool::FourPoints::getBox() const
{
- double x0 = tmin(getP00().x, getP10().x, getP01().x, getP11().x);
- double y0 = tmin(getP00().y, getP10().y, getP01().y, getP11().y);
- double x1 = tmax(getP00().x, getP10().x, getP01().x, getP11().x);
- double y1 = tmax(getP00().y, getP10().y, getP01().y, getP11().y);
+ double x0 = std::min({getP00().x, getP10().x, getP01().x, getP11().x});
+ double y0 = std::min({getP00().y, getP10().y, getP01().y, getP11().y});
+ double x1 = std::max({getP00().x, getP10().x, getP01().x, getP11().x});
+ double y1 = std::max({getP00().y, getP10().y, getP01().y, getP11().y});
return TRectD(TPointD(x0, y0), TPointD(x1, y1));
}
diff --git a/toonz/sources/tnztools/setsaveboxtool.cpp b/toonz/sources/tnztools/setsaveboxtool.cpp
index 0a2cd44db..7287df0e8 100644
--- a/toonz/sources/tnztools/setsaveboxtool.cpp
+++ b/toonz/sources/tnztools/setsaveboxtool.cpp
@@ -113,8 +113,8 @@ int SetSaveboxTool::getDragType(const TPointD &pos)
TRectD bbox = ToonzImageUtils::convertRasterToWorld(convert(image->getBBox()), image);
int ret = 0;
- int dx = tmin(fabs(bbox.x0 - pos.x), fabs(bbox.x1 - pos.x));
- int dy = tmin(fabs(bbox.y0 - pos.y), fabs(bbox.y1 - pos.y));
+ int dx = std::min(fabs(bbox.x0 - pos.x), fabs(bbox.x1 - pos.x));
+ int dy = std::min(fabs(bbox.y0 - pos.y), fabs(bbox.y1 - pos.y));
double maxDist = 5 * m_tool->getPixelSize();
if (dx > maxDist && dy > maxDist)
diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp
index 9e0ca3f93..b07928e7e 100644
--- a/toonz/sources/tnztools/typetool.cpp
+++ b/toonz/sources/tnztools/typetool.cpp
@@ -1616,8 +1616,8 @@ bool TypeTool::keyDown(int key, std::wstring unicodeChar, TUINT32 flags, const T
void TypeTool::onInputText(std::wstring preedit, std::wstring commit, int replacementStart, int replacementLen)
{
// butto la vecchia preedit string
- m_preeditRange.first = tmax(0, m_preeditRange.first);
- m_preeditRange.second = tmin((int)m_string.size(), m_preeditRange.second);
+ m_preeditRange.first = std::max(0, m_preeditRange.first);
+ m_preeditRange.second = std::min((int)m_string.size(), m_preeditRange.second);
if (m_preeditRange.first < m_preeditRange.second)
m_string.erase(m_string.begin() + m_preeditRange.first, m_string.begin() + m_preeditRange.second);
diff --git a/toonz/sources/tnztools/vectortapetool.cpp b/toonz/sources/tnztools/vectortapetool.cpp
index 95fbc8f22..eb622d5bc 100644
--- a/toonz/sources/tnztools/vectortapetool.cpp
+++ b/toonz/sources/tnztools/vectortapetool.cpp
@@ -301,7 +301,7 @@ public:
//TThickPoint point1 = stroke1->getControlPoint(m_cpIndex1);
m_pixelSize = getPixelSize();
- double thick = tmax(6.0 * m_pixelSize, point1.thick);
+ double thick = std::max(6.0 * m_pixelSize, point1.thick);
tglDrawCircle(point1, thick);
@@ -311,7 +311,7 @@ public:
if (m_strokeIndex2 != -1) {
TStroke *stroke2 = vi->getStroke(m_strokeIndex2);
point2 = stroke2->getPoint(m_w2);
- thick = tmax(6.0 * m_pixelSize, point2.thick);
+ thick = std::max(6.0 * m_pixelSize, point2.thick);
} else {
tglColor(TPixelD(0.6, 0.7, 0.4));
thick = 4 * m_pixelSize;
@@ -408,7 +408,7 @@ public:
return;
if (m_type.getValue() == RECT) {
- m_selectionRect = TRectD(tmin(m_startRect.x, pos.x), tmin(m_startRect.y, pos.y), tmax(m_startRect.x, pos.x), tmax(m_startRect.y, pos.y));
+ m_selectionRect = TRectD(std::min(m_startRect.x, pos.x), std::min(m_startRect.y, pos.y), std::max(m_startRect.x, pos.x), std::max(m_startRect.y, pos.y));
invalidate();
return;
}
@@ -475,8 +475,8 @@ public:
void joinPointToPoint(const TVectorImageP &vi, std::vector<TFilledRegionInf> *fillInfo)
{
- int minindex = tmin(m_strokeIndex1, m_strokeIndex2);
- int maxindex = tmax(m_strokeIndex1, m_strokeIndex2);
+ int minindex = std::min(m_strokeIndex1, m_strokeIndex2);
+ int maxindex = std::max(m_strokeIndex1, m_strokeIndex2);
UndoAutoclose *autoCloseUndo = 0;
TUndo *undo = 0;
@@ -580,8 +580,8 @@ public:
void inline rearrangeClosingPoints(const TVectorImageP &vi, std::pair<int, double> &closingPoint, const TPointD &p)
{
- int erasedIndex = tmax(m_strokeIndex1, m_strokeIndex2);
- int joinedIndex = tmin(m_strokeIndex1, m_strokeIndex2);
+ int erasedIndex = std::max(m_strokeIndex1, m_strokeIndex2);
+ int joinedIndex = std::min(m_strokeIndex1, m_strokeIndex2);
if (closingPoint.first == joinedIndex)
closingPoint.second = vi->getStroke(joinedIndex)->getW(p);
diff --git a/toonz/sources/toonz/adjustlevelspopup.cpp b/toonz/sources/toonz/adjustlevelspopup.cpp
index f5e148d38..02c8914f2 100644
--- a/toonz/sources/toonz/adjustlevelspopup.cpp
+++ b/toonz/sources/toonz/adjustlevelspopup.cpp
@@ -551,8 +551,8 @@ void AdjustLevelsPopup::autoAdjust()
::getRange(histograms->getHistogramView(2)->values(), m_threshold, minG, maxG);
::getRange(histograms->getHistogramView(3)->values(), m_threshold, minB, maxB);
- min = tmin(minR, minG, minB);
- max = tmax(maxR, maxG, maxB);
+ min = std::min({minR, minG, minB});
+ max = std::max({maxR, maxG, maxB});
} else
::getRange(values, m_threshold, min, max);
diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp
index 7de8bdcd9..d91918b51 100644
--- a/toonz/sources/toonz/cellselection.cpp
+++ b/toonz/sources/toonz/cellselection.cpp
@@ -1508,7 +1508,7 @@ void TCellSelection::pasteCells()
std::set<TKeyframeSelection::Position>::const_iterator it, end = positions.end();
for (it = positions.begin(); it != end; ++it)
- c1 = tmax(c1, it->second);
+ c1 = std::max(c1, it->second);
}
}
if (!initUndo) {
diff --git a/toonz/sources/toonz/cleanupsettingsmodel.cpp b/toonz/sources/toonz/cleanupsettingsmodel.cpp
index dc2ea28c3..ebed1edcc 100644
--- a/toonz/sources/toonz/cleanupsettingsmodel.cpp
+++ b/toonz/sources/toonz/cleanupsettingsmodel.cpp
@@ -367,8 +367,8 @@ void CleanupSettingsModel::commitChanges(int action)
}
// Perform actions
- int maxAction = tmax(action, m_action); // Add previuosly required actions
- action = tmin(maxAction, m_allowedActions); // But only up to the allowed action
+ int maxAction = std::max(action, m_action); // Add previuosly required actions
+ action = std::min(maxAction, m_allowedActions); // But only up to the allowed action
m_action = (action == maxAction) ? NONE : maxAction; // Then, update the previously required action
if (action >= FULLPROCESS)
diff --git a/toonz/sources/toonz/cleanupswatch.cpp b/toonz/sources/toonz/cleanupswatch.cpp
index a564637d9..f2b9fc3ff 100644
--- a/toonz/sources/toonz/cleanupswatch.cpp
+++ b/toonz/sources/toonz/cleanupswatch.cpp
@@ -153,7 +153,7 @@ void CleanupSwatch::CleanupSwatchArea::keyPressEvent(QKeyEvent *event)
double currZoomScale = sqrt(m_sw->m_viewAff.det());
double factor = getQuantizedZoomFactor(currZoomScale, forward);
- double minZoom = tmin((double)m_sw->m_lx / m_sw->m_resampledRaster->getLx(), (double)m_sw->m_ly / m_sw->m_resampledRaster->getLy());
+ double minZoom = std::min((double)m_sw->m_lx / m_sw->m_resampledRaster->getLx(), (double)m_sw->m_ly / m_sw->m_resampledRaster->getLy());
if ((!forward && factor < minZoom) || (forward && factor > 40.0))
return;
@@ -203,7 +203,7 @@ void CleanupSwatch::CleanupSwatchArea::wheelEvent(QWheelEvent *event)
if (factor == 1.0)
return;
double scale = m_sw->m_viewAff.det();
- double minZoom = tmin((double)m_sw->m_lx / m_sw->m_resampledRaster->getLx(), (double)m_sw->m_ly / m_sw->m_resampledRaster->getLy());
+ double minZoom = std::min((double)m_sw->m_lx / m_sw->m_resampledRaster->getLx(), (double)m_sw->m_ly / m_sw->m_resampledRaster->getLy());
if ((factor < 1 && sqrt(scale) < minZoom) || (factor > 1 && scale > 1200.0))
return;
diff --git a/toonz/sources/toonz/exportlevelcommand.cpp b/toonz/sources/toonz/exportlevelcommand.cpp
index 3924baa3a..1bcf4020e 100644
--- a/toonz/sources/toonz/exportlevelcommand.cpp
+++ b/toonz/sources/toonz/exportlevelcommand.cpp
@@ -139,7 +139,7 @@ struct VectorThicknessTransformer {
thickBackup.m_thicknesses.push_back(point.thick);
- point.thick = tmax(
+ point.thick = std::max(
tcg::poly_ops::evaluate(thickPoly, 1, point.thick),
0.0);
diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp
index 4febe2fe0..f28c096d2 100644
--- a/toonz/sources/toonz/filebrowserpopup.cpp
+++ b/toonz/sources/toonz/filebrowserpopup.cpp
@@ -1232,7 +1232,7 @@ void LoadLevelPopup::updateBottomGUI()
scene.setScenePath(fp);
int sceneLength = scene.getFrameCount();
QString str;
- m_fromFrame->setText(str.number(tmin(1, sceneLength)));
+ m_fromFrame->setText(str.number(std::min(1, sceneLength)));
m_toFrame->setText(str.number(sceneLength));
m_subsequenceFrame->setEnabled(false);
diff --git a/toonz/sources/toonz/flipbook.cpp b/toonz/sources/toonz/flipbook.cpp
index 566784ffd..1e25c7b04 100644
--- a/toonz/sources/toonz/flipbook.cpp
+++ b/toonz/sources/toonz/flipbook.cpp
@@ -1106,8 +1106,8 @@ void FlipBook::setLevel(const TFilePath &fp, TPalette *palette, int from, int to
}
if (level->begin()->first.getNumber() != TFrameId::NO_FRAME) {
- fromIndex = tmax(fromIndex, level->begin()->first.getNumber());
- toIndex = tmin(toIndex, (--level->end())->first.getNumber());
+ fromIndex = std::max(fromIndex, level->begin()->first.getNumber());
+ toIndex = std::min(toIndex, (--level->end())->first.getNumber());
} else {
fromIndex = level->begin()->first.getNumber();
toIndex = (--level->end())->first.getNumber();
@@ -1116,7 +1116,7 @@ void FlipBook::setLevel(const TFilePath &fp, TPalette *palette, int from, int to
//Workaround to display simple background images when loading from
//the right-click menu context
- fromIndex = tmin(fromIndex, toIndex);
+ fromIndex = std::min(fromIndex, toIndex);
}
Level levelToPush(level, fp, fromIndex, toIndex, step);
@@ -2002,8 +2002,8 @@ void FlipBook::adaptWidGeometry(const TRect &interestWidGeom, const TRect &imgWi
QSize flipMinimumSize(panel->minimumSize());
flipMinimumSize -= QSize(margins.right() - margins.left(), margins.bottom() - margins.top());
QSize minAddition(
- tceil(tmax(0, flipMinimumSize.width() - interestGeom.width()) * 0.5),
- tceil(tmax(0, flipMinimumSize.height() - interestGeom.height()) * 0.5));
+ tceil(std::max(0, flipMinimumSize.width() - interestGeom.width()) * 0.5),
+ tceil(std::max(0, flipMinimumSize.height() - interestGeom.height()) * 0.5));
interestGeom.adjust(-minAddition.width(), -minAddition.height(), minAddition.width(), minAddition.height());
//Translate to keep the current view top-left corner, if required
diff --git a/toonz/sources/toonz/historypane.cpp b/toonz/sources/toonz/historypane.cpp
index e13a085ec..ba6811717 100644
--- a/toonz/sources/toonz/historypane.cpp
+++ b/toonz/sources/toonz/historypane.cpp
@@ -88,7 +88,7 @@ HistoryField::HistoryField(QScrollArea *parent, Qt::WFlags flags)
setFocusPolicy(Qt::StrongFocus); /*-- KeyboadでもTabキーでもFocusされる --*/
setFixedHeight(parentWidget()->height());
- setMinimumWidth(tmax(parentWidget()->width(), 600));
+ setMinimumWidth(std::max(parentWidget()->width(), 600));
}
//-----------------------------------------------------------------------------
@@ -250,7 +250,7 @@ void HistoryPane::onHistoryChanged()
void HistoryPane::resizeEvent(QResizeEvent *e)
{
m_field->updateContentHeight();
- m_field->setFixedWidth(tmax(width(), 600));
+ m_field->setFixedWidth(std::max(width(), 600));
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp
index 280e1e32e..68220dedb 100644
--- a/toonz/sources/toonz/imageviewer.cpp
+++ b/toonz/sources/toonz/imageviewer.cpp
@@ -894,8 +894,8 @@ int ImageViewer::getDragType(const TPoint &pos, const TRect &loadbox)
if (loadbox == TRect())
return eDrawRect;
- int ret = 0, dx = tmin(abs(loadbox.x0 - pos.x), abs(loadbox.x1 - pos.x)),
- dy = tmin(abs(loadbox.y0 - pos.y), abs(loadbox.y1 - pos.y));
+ int ret = 0, dx = std::min(abs(loadbox.x0 - pos.x), abs(loadbox.x1 - pos.x)),
+ dy = std::min(abs(loadbox.y0 - pos.y), abs(loadbox.y1 - pos.y));
if (dx > 10 && dy > 10)
return (loadbox.contains(pos)) ? eMoveRect : eDrawRect;
@@ -1099,7 +1099,7 @@ void ImageViewer::adaptView(const TRect &imgRect, const TRect &viewRect)
QRect viewerRect(geometry());
double imageScale =
- tmin(viewerRect.width() / (double)viewRect.getLx(),
+ std::min(viewerRect.width() / (double)viewRect.getLx(),
viewerRect.height() / (double)viewRect.getLy());
TPointD viewRectCenter((viewRect.x0 + viewRect.x1 + 1) * 0.5, (viewRect.y0 + viewRect.y1 + 1) * 0.5);
diff --git a/toonz/sources/toonz/keyframedata.cpp b/toonz/sources/toonz/keyframedata.cpp
index e01c729c6..935d2cfc8 100644
--- a/toonz/sources/toonz/keyframedata.cpp
+++ b/toonz/sources/toonz/keyframedata.cpp
@@ -46,8 +46,8 @@ void TKeyframeData::setKeyframes(std::set<Position> positions, TXsheet *xsh)
int r0 = it->first;
int c0 = it->second;
for (++it; it != positions.end(); ++it) {
- r0 = tmin(r0, it->first);
- c0 = tmin(c0, it->second);
+ r0 = std::min(r0, it->first);
+ c0 = std::min(c0, it->second);
}
for (it = positions.begin(); it != positions.end(); ++it) {
@@ -73,8 +73,8 @@ bool TKeyframeData::getKeyframes(std::set<Position> &positions, TXsheet *xsh) co
int r0 = it2->first;
int c0 = it2->second;
for (++it2; it2 != positions.end(); ++it2) {
- r0 = tmin(r0, it2->first);
- c0 = tmin(c0, it2->second);
+ r0 = std::min(r0, it2->first);
+ c0 = std::min(c0, it2->second);
}
positions.clear();
TStageObjectId cameraId = xsh->getStageObjectTree()->getCurrentCameraId();
diff --git a/toonz/sources/toonz/matchline.cpp b/toonz/sources/toonz/matchline.cpp
index 5621817ed..aa5c0f7d6 100644
--- a/toonz/sources/toonz/matchline.cpp
+++ b/toonz/sources/toonz/matchline.cpp
@@ -931,7 +931,7 @@ std::vector<int> string2Indexes(const QString &values)
if (!ok)
return std::vector<int>();
- for (j = tmin(from, to); j <= tmax(from, to); j++)
+ for (j = std::min(from, to); j <= std::max(from, to); j++)
ret.push_back(j);
} else {
int val = vals.at(i).toInt(&ok);
diff --git a/toonz/sources/toonz/mergecmapped.cpp b/toonz/sources/toonz/mergecmapped.cpp
index 2579280d9..ce76836f4 100644
--- a/toonz/sources/toonz/mergecmapped.cpp
+++ b/toonz/sources/toonz/mergecmapped.cpp
@@ -683,7 +683,7 @@ std::vector<int> string2Indexes(const QString &values)
if (!ok)
return std::vector<int>();
- for (j = tmin(from, to); j <= tmax(from, to); j++)
+ for (j = std::min(from, to); j <= std::max(from, to); j++)
ret.push_back(j);
} else {
int val = vals.at(i).toInt(&ok);
diff --git a/toonz/sources/toonz/meshifypopup.cpp b/toonz/sources/toonz/meshifypopup.cpp
index 58e5dbfe9..a461acd95 100644
--- a/toonz/sources/toonz/meshifypopup.cpp
+++ b/toonz/sources/toonz/meshifypopup.cpp
@@ -106,7 +106,7 @@ TRaster32P render(const TVectorImageP &vi, double &rasDpi, int margin,
// Ensure that the maximum lateral resolution is respected
if (scale * bboxD.getLx() > RENDERED_IMAGES_MAX_LATERAL_RESOLUTION ||
scale * bboxD.getLy() > RENDERED_IMAGES_MAX_LATERAL_RESOLUTION) {
- scale = tmin(RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bboxD.getLx(),
+ scale = std::min(RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bboxD.getLx(),
RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bboxD.getLy());
}
@@ -155,7 +155,7 @@ TRaster32P render(const TXsheet *xsh, int row, double &rasDpi, int margin,
// Ensure that the maximum lateral resolution is respected
if (scale * bbox.getLx() > RENDERED_IMAGES_MAX_LATERAL_RESOLUTION ||
scale * bbox.getLy() > RENDERED_IMAGES_MAX_LATERAL_RESOLUTION) {
- scale = tmin(RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bbox.getLx(),
+ scale = std::min(RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bbox.getLx(),
RENDERED_IMAGES_MAX_LATERAL_RESOLUTION / bbox.getLy());
}
@@ -1173,8 +1173,8 @@ void meshifySelection(Func func,
if (!column || column->isEmpty())
continue;
- r0 = tmin(r0, column->getFirstRow());
- r1 = tmax(r1, column->getMaxFrame());
+ r0 = std::min(r0, column->getFirstRow());
+ r1 = std::max(r1, column->getMaxFrame());
}
(*func)(r0, c0, r1, c1, options);
diff --git a/toonz/sources/toonz/moviegenerator.cpp b/toonz/sources/toonz/moviegenerator.cpp
index 8f22c2a11..c75bc0f89 100644
--- a/toonz/sources/toonz/moviegenerator.cpp
+++ b/toonz/sources/toonz/moviegenerator.cpp
@@ -192,7 +192,7 @@ public:
double sx = (double)m_offlineGlContext.getLx() / (double)cameraRes.lx;
double sy = (double)m_offlineGlContext.getLy() / (double)cameraRes.ly;
- double sc = tmin(sx, sy);
+ double sc = std::min(sx, sy);
// TAffine cameraAff = scene.getXsheet()->getPlacement(TStageObjectId::CameraId(0), row);
TAffine cameraAff = scene.getXsheet()->getCameraAff(row);
@@ -277,7 +277,7 @@ public:
m_whiteSample = 0;
}
TINT32 fromSample = m_st->getSampleCount();
- TINT32 numSample = tmax(
+ TINT32 numSample = std::max(
TINT32(sceneFrameCount * samplePerFrame),
snd1->getSampleCount());
m_st = TSop::insertBlank(m_st, fromSample, numSample + m_whiteSample);
diff --git a/toonz/sources/toonz/outputsettingspopup.cpp b/toonz/sources/toonz/outputsettingspopup.cpp
index 3d7d9f0a0..74dd38e10 100644
--- a/toonz/sources/toonz/outputsettingspopup.cpp
+++ b/toonz/sources/toonz/outputsettingspopup.cpp
@@ -1020,7 +1020,7 @@ void OutputSettingsPopup::onFrameFldEditFinished()
return;
TOutputProperties *prop = getProperties();
- int maxR0 = tmax(0, scene->getFrameCount() - 1);
+ int maxR0 = std::max(0, scene->getFrameCount() - 1);
int r0 = (int)m_startFld->getValue() - 1;
int r1 = (int)m_endFld->getValue() - 1;
int step = (int)m_stepFld->getValue();
diff --git a/toonz/sources/toonz/pltgizmopopup.cpp b/toonz/sources/toonz/pltgizmopopup.cpp
index cbf896852..e97fafc1d 100644
--- a/toonz/sources/toonz/pltgizmopopup.cpp
+++ b/toonz/sources/toonz/pltgizmopopup.cpp
@@ -118,7 +118,7 @@ public:
{
std::vector<TColorStyle *> styles;
getStyles(styles, m_selection, m_palette);
- int n = tmin(styles.size(), colors.size());
+ int n = std::min(styles.size(), colors.size());
for (int i = 0; i < n; i++) {
QString gname = QString::fromStdWString(styles[i]->getGlobalName());
if (!gname.isEmpty() && gname[0] != L'-')
diff --git a/toonz/sources/toonz/previewfxmanager.cpp b/toonz/sources/toonz/previewfxmanager.cpp
index 25cea5303..2ccbc2bb7 100644
--- a/toonz/sources/toonz/previewfxmanager.cpp
+++ b/toonz/sources/toonz/previewfxmanager.cpp
@@ -530,8 +530,8 @@ void PreviewFxInstance::updateFrameRange()
//Intersect with the fx active frame range
TRasterFxP rasterFx(m_fx);
TFxTimeRegion timeRegion(rasterFx->getTimeRegion());
- m_start = tmax(timeRegion.getFirstFrame(), m_start);
- m_end = tmin(timeRegion.getLastFrame(), m_end);
+ m_start = std::max(timeRegion.getFirstFrame(), m_start);
+ m_end = std::min(timeRegion.getLastFrame(), m_end);
//Release all images not in the new frame range
std::map<int, FrameInfo>::iterator it, jt;
@@ -588,7 +588,7 @@ void PreviewFxInstance::updateInitialFrame()
std::set<FlipBook *>::iterator kt;
m_initFrame = (std::numeric_limits<int>::max)();
for (kt = m_flipbooks.begin(); kt != m_flipbooks.end(); ++kt)
- m_initFrame = tmin(m_initFrame, (*kt)->getCurrentFrame() - 1);
+ m_initFrame = std::min(m_initFrame, (*kt)->getCurrentFrame() - 1);
cropAndStep(m_initFrame);
}
diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp
index d7f1e00f2..cc4847801 100644
--- a/toonz/sources/toonz/sceneviewer.cpp
+++ b/toonz/sources/toonz/sceneviewer.cpp
@@ -1678,8 +1678,8 @@ TRect SceneViewer::getActualClipRect(const TAffine &aff)
TPointD p01 = winToWorld(clipRect.getP01());
TPointD p10 = winToWorld(clipRect.getP10());
TPointD p11 = winToWorld(clipRect.getP11());
- clipRect = TRect(TPoint(tmin(p00.x, p01.x), tmin(p00.y, p10.y)),
- TPoint(tmax(p11.x, p10.x), tmax(p11.y, p01.y)));
+ clipRect = TRect(TPoint(std::min(p00.x, p01.x), std::min(p00.y, p10.y)),
+ TPoint(std::max(p11.x, p10.x), std::max(p11.y, p01.y)));
} else if (m_clipRect.isEmpty())
clipRect -= TPoint(viewerSize.lx / 2, viewerSize.ly / 2);
else {
@@ -1938,7 +1938,7 @@ double SceneViewer::getZoomScaleFittingWithScreen()
//fit to either direction
int moni_x = rec.width() - (margin * 2);
int moni_y = rec.height() - (margin * 2);
- return tmin((double)moni_x / (double)imgSize.lx, (double)moni_y / (double)imgSize.ly);
+ return std::min((double)moni_x / (double)imgSize.lx, (double)moni_y / (double)imgSize.ly);
}
//-----------------------------------------------------------------------------
@@ -2048,8 +2048,8 @@ void SceneViewer::fitToCamera()
TPointD P10 = cameraAff * cameraRect.getP10();
TPointD P01 = cameraAff * cameraRect.getP01();
TPointD P11 = cameraAff * cameraRect.getP11();
- TPointD p0 = TPointD(tmin(P00.x, P01.x, P10.x, P11.x), tmin(P00.y, P01.y, P10.y, P11.y));
- TPointD p1 = TPointD(tmax(P00.x, P01.x, P10.x, P11.x), tmax(P00.y, P01.y, P10.y, P11.y));
+ TPointD p0 = TPointD(std::min({P00.x, P01.x, P10.x, P11.x}), std::min({P00.y, P01.y, P10.y, P11.y}));
+ TPointD p1 = TPointD(std::max({P00.x, P01.x, P10.x, P11.x}), std::max({P00.y, P01.y, P10.y, P11.y}));
cameraRect = TRectD(p0.x, p0.y, p1.x, p1.y);
// Pan
@@ -2060,7 +2060,7 @@ void SceneViewer::fitToCamera()
double xratio = (double)viewRect.width() / cameraRect.getLx();
double yratio = (double)viewRect.height() / cameraRect.getLy();
- double ratio = tmin(xratio, yratio);
+ double ratio = std::min(xratio, yratio);
// Scale and center on the center of \a rect.
QPoint c = viewRect.center();
@@ -2426,7 +2426,7 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d,
glEnable(GL_LINE_STIPPLE);
tglMultMatrix(aff);
- double pixelSize = tmax(0.1, pixelsize);
+ double pixelSize = std::max(0.1, pixelsize);
double strokeLength = stroke->getLength();
int n = (int)(5 + (strokeLength / pixelSize) * 0.1);
diff --git a/toonz/sources/toonz/subcameramanager.cpp b/toonz/sources/toonz/subcameramanager.cpp
index 5a051429f..99d7911a8 100644
--- a/toonz/sources/toonz/subcameramanager.cpp
+++ b/toonz/sources/toonz/subcameramanager.cpp
@@ -161,10 +161,10 @@ bool PreviewSubCameraManager::mouseMoveEvent(SceneViewer *viewer, QMouseEvent *e
worldCurPos = cameraAffInv * worldCurPos;
TRectD worldPreviewSubCameraRect(
- tmin(worldMousePressPos.x, worldCurPos.x),
- tmin(worldMousePressPos.y, worldCurPos.y),
- tmax(worldMousePressPos.x, worldCurPos.x),
- tmax(worldMousePressPos.y, worldCurPos.y));
+ std::min(worldMousePressPos.x, worldCurPos.x),
+ std::min(worldMousePressPos.y, worldCurPos.y),
+ std::max(worldMousePressPos.x, worldCurPos.x),
+ std::max(worldMousePressPos.y, worldCurPos.y));
TCamera *camera = app->getCurrentScene()->getScene()->getCurrentCamera();
//camera->setInterestStageRect(worldPreviewSubCameraRect);
@@ -276,10 +276,10 @@ UCHAR PreviewSubCameraManager::getSubCameraDragEnum(SceneViewer *viewer, const Q
TPointD cameraPosB(winToCamera(viewer, mousePos + QPoint(0, 10)));
TRectD cameraPosBox(
- tmin(cameraPosL.x, cameraPosR.x, cameraPosT.x, cameraPosB.x),
- tmin(cameraPosL.y, cameraPosR.y, cameraPosT.y, cameraPosB.y),
- tmax(cameraPosL.x, cameraPosR.x, cameraPosT.x, cameraPosB.x),
- tmax(cameraPosL.y, cameraPosR.y, cameraPosT.y, cameraPosB.y));
+ std::min({cameraPosL.x, cameraPosR.x, cameraPosT.x, cameraPosB.x}),
+ std::min({cameraPosL.y, cameraPosR.y, cameraPosT.y, cameraPosB.y}),
+ std::max({cameraPosL.x, cameraPosR.x, cameraPosT.x, cameraPosB.x}),
+ std::max({cameraPosL.y, cameraPosR.y, cameraPosT.y, cameraPosB.y}));
TRectD subCameraD(subCamera.x0, subCamera.y0, subCamera.x1 + 1, subCamera.y1 + 1);
diff --git a/toonz/sources/toonz/vcrcommand.cpp b/toonz/sources/toonz/vcrcommand.cpp
index 4c851ddcc..e118dbba1 100644
--- a/toonz/sources/toonz/vcrcommand.cpp
+++ b/toonz/sources/toonz/vcrcommand.cpp
@@ -132,7 +132,7 @@ public:
int row = TApp::instance()->getCurrentFrame()->getFrame();
int step = Preferences::instance()->getXsheetStep();
- TApp::instance()->getCurrentFrame()->setFrame(tmax(row - step, 0));
+ TApp::instance()->getCurrentFrame()->setFrame(std::max(row - step, 0));
}
};
diff --git a/toonz/sources/toonz/vectorizerpopup.cpp b/toonz/sources/toonz/vectorizerpopup.cpp
index 7306952c9..b7c88dd5f 100644
--- a/toonz/sources/toonz/vectorizerpopup.cpp
+++ b/toonz/sources/toonz/vectorizerpopup.cpp
@@ -373,7 +373,7 @@ int Vectorizer::doVectorize()
center = ri->getRaster()->getCenterD();
// Build vectorizer configuration
- double weight = (ft->getNumber() - 1 - frameRange[0]) / tmax(frameRange[1] - frameRange[0], 1.0);
+ double weight = (ft->getNumber() - 1 - frameRange[0]) / std::max(frameRange[1] - frameRange[0], 1.0);
weight = tcrop(weight, 0.0, 1.0);
locals.updateConfig(weight); // TEMPORARY
diff --git a/toonz/sources/toonz/viewerdraw.cpp b/toonz/sources/toonz/viewerdraw.cpp
index 535abcfc6..dba98ec17 100644
--- a/toonz/sources/toonz/viewerdraw.cpp
+++ b/toonz/sources/toonz/viewerdraw.cpp
@@ -252,8 +252,8 @@ void ViewerDraw::drawCameraMask(SceneViewer *viewer)
tglFillRect(x1, bounds.y0, bounds.x1, bounds.y1);
if (x0 < bounds.x1 && x1 > bounds.x0) {
- double xa = tmax(x0, bounds.x0);
- double xb = tmin(x1, bounds.x1);
+ double xa = std::max(x0, bounds.x0);
+ double xb = std::min(x1, bounds.x1);
if (bounds.y0 < y0)
tglFillRect(xa, bounds.y0, xb, y0);
if (y1 < bounds.y1)
@@ -291,10 +291,10 @@ void ViewerDraw::drawGridAndGuides(
TPointD p10 = mat * convert(clipRect.getP10());
TPointD p11 = mat * convert(clipRect.getP11());
- double xmin = tmin(p00.x, p01.x, p10.x, p11.x);
- double xmax = tmax(p00.x, p01.x, p10.x, p11.x);
- double ymin = tmin(p00.y, p01.y, p10.y, p11.y);
- double ymax = tmax(p00.y, p01.y, p10.y, p11.y);
+ double xmin = std::min({p00.x, p01.x, p10.x, p11.x});
+ double xmax = std::max({p00.x, p01.x, p10.x, p11.x});
+ double ymin = std::min({p00.y, p01.y, p10.y, p11.y});
+ double ymax = std::max({p00.y, p01.y, p10.y, p11.y});
double step = 10;
if (sc * step < 4)
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index 32645ff89..4550e2f07 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -723,11 +723,11 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated)
int currentRow = m_viewer->getCurrentRow();
int col, row;
- int x0 = tmax(1, toBeUpdated.left());
- int x1 = tmin(width(), toBeUpdated.right());
+ int x0 = std::max(1, toBeUpdated.left());
+ int x1 = std::min(width(), toBeUpdated.right());
- int y0 = tmax(1, toBeUpdated.top());
- int y1 = tmin(height() - 2, toBeUpdated.bottom());
+ int y0 = std::max(1, toBeUpdated.top());
+ int y1 = std::min(height() - 2, toBeUpdated.bottom());
m_soundLevelModifyRects.clear();
for (col = c0; col <= c1; col++) {
int x = m_viewer->columnToX(col);
@@ -1325,8 +1325,8 @@ void CellArea::drawKeyframe(QPainter &p, const QRect toBeUpdated)
continue;
bool emptyKeyframeRange = row0 >= row1;
int row;
- row0 = tmax(row0, r0);
- row1 = tmin(row1, r1);
+ row0 = std::max(row0, r0);
+ row1 = std::min(row1, r1);
/*- first, draw key segments -*/
p.setPen(m_viewer->getTextColor());
@@ -1491,7 +1491,7 @@ bool CellArea::getEaseHandles(
int m = tfloor(0.5 * (r0 + e0 + r1 - e1));
m = tcrop(m, r0 + 2, r1 - 2);
int a = r0 + 2;
- int b = tmin(m, r1 - 3);
+ int b = std::min(m, r1 - 3);
assert(a <= b);
rh0 = tcrop((int)(r0 + e0 + 0.5), a, b);
a = rh0 + 1;
diff --git a/toonz/sources/toonz/xsheetcmd.cpp b/toonz/sources/toonz/xsheetcmd.cpp
index ab45c6670..f079083b9 100644
--- a/toonz/sources/toonz/xsheetcmd.cpp
+++ b/toonz/sources/toonz/xsheetcmd.cpp
@@ -1124,7 +1124,7 @@ public:
TStageObject::Keyframe keyframe0 = pegbar->getKeyframe(r0);
TStageObject::Keyframe keyframe1 = pegbar->getKeyframe(r1);
- int dr = tmax(r1 - r0, 0);
+ int dr = std::max(r1 - r0, 0);
if (keyframe0.m_easeOut == dr)
return;
@@ -1173,7 +1173,7 @@ public:
TStageObject::Keyframe keyframe0 = pegbar->getKeyframe(r0);
TStageObject::Keyframe keyframe1 = pegbar->getKeyframe(r1);
- int dr = tmax(r1 - r0, 0);
+ int dr = std::max(r1 - r0, 0);
if (keyframe1.m_easeIn == dr)
return;
@@ -1556,21 +1556,21 @@ void XsheetWriter::write(ostream &os)
int c0, c1;
c0 = 0;
for (;;) {
- c1 = tmin(totColCount, c0 + columnsPerPage) - 1;
+ c1 = std::min(totColCount, c0 + columnsPerPage) - 1;
int ca0 = 0, ca1 = -1, cb0 = 0, cb1 = -1;
if (c0 < colCount) {
ca0 = c0;
- ca1 = tmin(colCount - 1, c1);
+ ca1 = std::min(colCount - 1, c1);
}
if (c1 >= colCount) {
- cb0 = tmax(c0, colCount);
+ cb0 = std::max(c0, colCount);
cb1 = c1;
}
int r0, r1, r, c;
r0 = 0;
for (;;) {
- r1 = tmin(rowCount, r0 + rowsPerPage) - 1;
+ r1 = std::min(rowCount, r0 + rowsPerPage) - 1;
tableCaption(os);
os << "<table>" << endl
<< "<tr>" << endl;
diff --git a/toonz/sources/toonz/xsheetdragtool.cpp b/toonz/sources/toonz/xsheetdragtool.cpp
index 1da177a49..a50357a71 100644
--- a/toonz/sources/toonz/xsheetdragtool.cpp
+++ b/toonz/sources/toonz/xsheetdragtool.cpp
@@ -2044,8 +2044,8 @@ public:
void onRelease(int row, int col)
{
- int r0 = tmin(row, m_startRow);
- int r1 = tmax(row, m_startRow);
+ int r0 = std::min(row, m_startRow);
+ int r1 = std::max(row, m_startRow);
assert(m_soundColumn);
TApp *app = TApp::instance();
ToonzScene *scene = app->getCurrentScene()->getScene();
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index 735825f77..91769c477 100644
--- a/toonz/sources/toonz/xsheetviewer.cpp
+++ b/toonz/sources/toonz/xsheetviewer.cpp
@@ -406,7 +406,7 @@ void XsheetViewer::setAutoPanSpeed(const QPoint &speed)
int getAutoPanSpeed(int pixels)
{
int f = 40;
- return tmin(100, (f - 1 + pixels * f) / 100);
+ return std::min(100, (f - 1 + pixels * f) / 100);
}
//-----------------------------------------------------------------------------
@@ -579,8 +579,8 @@ void XsheetViewer::setScrubHighlight(int row, int startRow, int col)
{
if (m_scrubCol == -1)
m_scrubCol = col;
- m_scrubRow0 = tmin(row, startRow);
- m_scrubRow1 = tmax(row, startRow);
+ m_scrubRow0 = std::min(row, startRow);
+ m_scrubRow1 = std::max(row, startRow);
return;
}
@@ -781,13 +781,13 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event)
switch (int key = event->key()) {
case Qt::Key_Up:
- setCurrentRow(tmax(row - 1, 0));
+ setCurrentRow(std::max(row - 1, 0));
break;
case Qt::Key_Down:
setCurrentRow(row + 1);
break;
case Qt::Key_Left:
- setCurrentColumn(tmax(col - 1, 0));
+ setCurrentColumn(std::max(col - 1, 0));
break;
case Qt::Key_Right:
setCurrentColumn(col + 1);
diff --git a/toonz/sources/toonz/xshrowviewer.cpp b/toonz/sources/toonz/xshrowviewer.cpp
index ed39ff7c2..f450792e2 100644
--- a/toonz/sources/toonz/xshrowviewer.cpp
+++ b/toonz/sources/toonz/xshrowviewer.cpp
@@ -439,7 +439,7 @@ void RowArea::mousePressEvent(QMouseEvent *event)
}
m_viewer->getCellSelection()->selectNone();
- m_viewer->getCellSelection()->selectCells(row, 0, row, tmax(0, filledCol));
+ m_viewer->getCellSelection()->selectCells(row, 0, row, std::max(0, filledCol));
m_viewer->updateCellRowAree();
}
diff --git a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp
index fa06a2086..b79175906 100644
--- a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp
+++ b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp
@@ -592,7 +592,7 @@ bool TFarmTaskGroup::changeChunkSize(int chunksize)
if (subCount > 1) {
int ra = m_from;
for (int i = 1; i <= subCount; ++i) {
- int rb = tmin(ra + m_chunkSize - 1, m_to);
+ int rb = std::min(ra + m_chunkSize - 1, m_to);
try {
QString subName = m_name + " " + toString(ra, 2, '0') + "-" + toString(rb, 2, '0');
@@ -650,7 +650,7 @@ TFarmTaskGroup::TFarmTaskGroup(
int ra = from;
if (subCount > 1) {
for (int i = 1; i <= subCount; ++i) {
- int rb = tmin(ra + chunksize - 1, to);
+ int rb = std::min(ra + chunksize - 1, to);
try {
QString subName = name + " " + toString(ra, 2, '0') + "-" + toString(rb, 2, '0');
diff --git a/toonz/sources/toonzlib/autoadjust.cpp b/toonz/sources/toonzlib/autoadjust.cpp
index c46e523dd..f24058066 100644
--- a/toonz/sources/toonzlib/autoadjust.cpp
+++ b/toonz/sources/toonzlib/autoadjust.cpp
@@ -452,8 +452,8 @@ void build_lw_lut(float ref_lw[256], float lw[256], UCHAR lut[256])
top_lw = lw[i];
top_gr = i;
- min_lw = tmax(bot_ref_lw, bot_lw);
- max_lw = tmin(top_ref_lw, top_lw);
+ min_lw = std::max(bot_ref_lw, bot_lw);
+ max_lw = std::min(top_ref_lw, top_lw);
if (min_lw >= max_lw) {
for (i = 0; i < 256; i++)
diff --git a/toonz/sources/toonzlib/autoclose.cpp b/toonz/sources/toonzlib/autoclose.cpp
index 5c10bb70d..8674ae931 100644
--- a/toonz/sources/toonzlib/autoclose.cpp
+++ b/toonz/sources/toonzlib/autoclose.cpp
@@ -351,7 +351,7 @@ namespace
int intersect_segment(int x1, int y1, int x2, int y2, int i, double *ris)
{
- if ((i < tmin(y1, y2)) || (i > tmax(y1, y2)) || (y1 == y2))
+ if ((i < std::min(y1, y2)) || (i > std::max(y1, y2)) || (y1 == y2))
return 0;
*ris = ((double)((x1 - x2) * (i - y2)) / (double)(y1 - y2) + x2);
@@ -399,13 +399,13 @@ int intersect_triangle(int x1a, int y1a, int x2a, int y2a, int x3a, int y3a,
int minx, maxx, miny, maxy, i;
double xamin, xamax, xbmin, xbmax, val;
- miny = tmax(tmin(y1a, y2a, y3a), tmin(y1b, y2b, y3b));
- maxy = tmin(tmax(y1a, y2a, y3a), tmax(y1b, y2b, y3b));
+ miny = std::max(std::min({y1a, y2a, y3a}), std::min({y1b, y2b, y3b}));
+ maxy = std::min(std::max({y1a, y2a, y3a}), std::max({y1b, y2b, y3b}));
if (maxy < miny)
return 0;
- minx = tmax(tmin(x1a, x2a, x3a), tmin(x1b, x2b, x3b));
- maxx = tmin(tmax(x1a, x2a, x3a), tmax(x1b, x2b, x3b));
+ minx = std::max(std::min({x1a, x2a, x3a}), std::min({x1b, x2b, x3b}));
+ maxx = std::min(std::max({x1a, x2a, x3a}), std::max({x1b, x2b, x3b}));
if (maxx < minx)
return 0;
diff --git a/toonz/sources/toonzlib/convert2tlv.cpp b/toonz/sources/toonzlib/convert2tlv.cpp
index 3be178239..d9ba2a65a 100644
--- a/toonz/sources/toonzlib/convert2tlv.cpp
+++ b/toonz/sources/toonzlib/convert2tlv.cpp
@@ -85,7 +85,7 @@ int findClosest(const std::map<TPixel, int> &colorMap, TPixel &curPixColor)
TPoint getClosestToneValue(const TRasterCM32P &r, int y, int x, int tone)
{
- int maxRad = tmin(x, r->getLx() - x - 1, y, r->getLy() - y - 1);
+ int maxRad = std::min({x, r->getLx() - x - 1, y, r->getLy() - y - 1});
for (int rad = 1; rad < maxRad; rad++) {
CHECKCOLOR(r, x, y - rad, tone)
@@ -148,7 +148,7 @@ int getMaxMatte(const TRaster32P &r)
for (int i = 0; i < r->getLy(); i++) {
TPixel32 *pix = r->pixels(i);
for (int j = 0; j < r->getLx(); j++, pix++) {
- maxMatte = tmax(maxMatte, (int)pix->m);
+ maxMatte = std::max(maxMatte, (int)pix->m);
if (pix->m != 255)
withMatte = true;
}
@@ -742,8 +742,8 @@ bool Convert2Tlv::init(std::string &errorMessage)
errorMessage = "Error: all frames must have 8 bits per channel!\n";
return false;
}
- m_size.lx = tmax(m_size.lx, info1->m_lx);
- m_size.ly = tmax(m_size.ly, info1->m_ly);
+ m_size.lx = std::max(m_size.lx, info1->m_lx);
+ m_size.ly = std::max(m_size.ly, info1->m_ly);
if (m_lr2 != TLevelReaderP()) {
TImageReaderP ir2 = m_lr2->getFrameReader(it2->first);
diff --git a/toonz/sources/toonzlib/doubleparamcmd.cpp b/toonz/sources/toonzlib/doubleparamcmd.cpp
index 0a7b891f9..986c66edd 100644
--- a/toonz/sources/toonzlib/doubleparamcmd.cpp
+++ b/toonz/sources/toonzlib/doubleparamcmd.cpp
@@ -323,7 +323,7 @@ void KeyframeSetter::moveKeyframes(int dFrame, double dValue)
dFrame -= 1;
}
- dFrame = dFrameSgn * tmax(0, dFrame);
+ dFrame = dFrameSgn * std::max(0, dFrame);
if (dFrame != preferredDFrame)
m_extraDFrame = preferredDFrame - dFrame;
// at this point dFrame (possibly ==0) is ok (no keyframe collisions, no segment type mismatches)
diff --git a/toonz/sources/toonzlib/fill.cpp b/toonz/sources/toonzlib/fill.cpp
index d1401cade..28a528917 100644
--- a/toonz/sources/toonzlib/fill.cpp
+++ b/toonz/sources/toonzlib/fill.cpp
@@ -505,8 +505,8 @@ TPoint nearestInk(const TRasterCM32P &r, const TPoint &p, int ray)
int i, j;
TPixelCM32 *buf = (TPixelCM32 *)r->getRawData();
- for (j = tmax(p.y - ray, 0); j <= tmin(p.y + ray, r->getLy() - 1); j++)
- for (i = tmax(p.x - ray, 0); i <= tmin(p.x + ray, r->getLx() - 1); i++)
+ for (j = std::max(p.y - ray, 0); j <= std::min(p.y + ray, r->getLy() - 1); j++)
+ for (i = std::max(p.x - ray, 0); i <= std::min(p.x + ray, r->getLx() - 1); i++)
if (!(buf + j * r->getWrap() + i)->isPurePaint())
return TPoint(i, j);
diff --git a/toonz/sources/toonzlib/fillutil.cpp b/toonz/sources/toonzlib/fillutil.cpp
index 6de23b904..f7601b7d8 100644
--- a/toonz/sources/toonzlib/fillutil.cpp
+++ b/toonz/sources/toonzlib/fillutil.cpp
@@ -55,8 +55,8 @@ void fillArea(const TRasterCM32P &ras, TRegion *r, int colorId,
for (UINT j = 0; j < intersections.size(); j += 2) {
if (intersections[j] == intersections[j + 1])
continue;
- int from = tmax(tfloor(intersections[j]), bbox.x0);
- int to = tmin(tceil(intersections[j + 1]), bbox.x1);
+ int from = std::max(tfloor(intersections[j]), bbox.x0);
+ int to = std::min(tceil(intersections[j + 1]), bbox.x1);
TPixelCM32 *pix = line + from;
for (int k = from; k < to; k++, pix++) {
if (fillPaints && (!onlyUnfilled || pix->getPaint() == 0))
@@ -679,8 +679,8 @@ TPoint InkSegmenter::nearestInk(const TPoint &p, int ray)
{
int i, j;
- for (j = tmax(p.y - ray, 0); j <= tmin(p.y + ray, m_ly - 1); j++)
- for (i = tmax(p.x - ray, 0); i <= tmin(p.x + ray, m_lx - 1); i++)
+ for (j = std::max(p.y - ray, 0); j <= std::min(p.y + ray, m_ly - 1); j++)
+ for (i = std::max(p.x - ray, 0); i <= std::min(p.x + ray, m_lx - 1); i++)
if (!(m_buf + j * m_wrap + i)->isPurePaint())
return TPoint(i, j);
diff --git a/toonz/sources/toonzlib/fxdag.cpp b/toonz/sources/toonzlib/fxdag.cpp
index 5030fe61b..80c952470 100644
--- a/toonz/sources/toonzlib/fxdag.cpp
+++ b/toonz/sources/toonzlib/fxdag.cpp
@@ -325,7 +325,7 @@ void FxDag::loadData(TIStream &is)
continue;
}
int fxTypeCount = getFxTypeCount(fx);
- int maxFxTypeId = tmax(fxTypeCount, fx->getAttributes()->getId());
+ int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
updateFxTypeTable(fx, maxFxTypeId);
TMacroFx *macroFx = dynamic_cast<TMacroFx *>(fx);
if (macroFx) {
@@ -334,7 +334,7 @@ void FxDag::loadData(TIStream &is)
for (j = 0; j < (int)fxs.size(); j++) {
TFxP inMacroFx = fxs[j];
fxTypeCount = getFxTypeCount(inMacroFx.getPointer());
- maxFxTypeId = tmax(fxTypeCount, inMacroFx->getAttributes()->getId());
+ maxFxTypeId = std::max(fxTypeCount, inMacroFx->getAttributes()->getId());
updateFxTypeTable(inMacroFx.getPointer(), maxFxTypeId);
m_idTable[toLower(inMacroFx->getFxId())] = inMacroFx.getPointer();
}
@@ -357,7 +357,7 @@ void FxDag::loadData(TIStream &is)
continue;
}
int fxTypeCount = getFxTypeCount(fx);
- int maxFxTypeId = tmax(fxTypeCount, fx->getAttributes()->getId());
+ int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
updateFxTypeTable(fx, maxFxTypeId);
m_idTable[toLower(fx->getFxId())] = fx;
}
diff --git a/toonz/sources/toonzlib/ikjacobian.cpp b/toonz/sources/toonzlib/ikjacobian.cpp
index 715a6ad6b..4d0035f0e 100644
--- a/toonz/sources/toonzlib/ikjacobian.cpp
+++ b/toonz/sources/toonzlib/ikjacobian.cpp
@@ -56,7 +56,7 @@ MatrixRmn MatrixRmn::WorkMatrix; // Temporary work matrix
// Fill the diagonal entries with the value d. The rest of the matrix is unchanged.
void MatrixRmn::SetDiagonalEntries(double d)
{
- long diagLen = tmin(NumRows, NumCols);
+ long diagLen = std::min(NumRows, NumCols);
double *dPtr = x;
for (; diagLen > 0; diagLen--) {
*dPtr = d;
@@ -67,7 +67,7 @@ void MatrixRmn::SetDiagonalEntries(double d)
// Fill the diagonal entries with values in vector d. The rest of the matrix is unchanged.
void MatrixRmn::SetDiagonalEntries(const VectorRn &d)
{
- long diagLen = tmin(NumRows, NumCols);
+ long diagLen = std::min(NumRows, NumCols);
assert(d.length == diagLen);
double *dPtr = x;
double *from = d.x;
@@ -80,7 +80,7 @@ void MatrixRmn::SetDiagonalEntries(const VectorRn &d)
// Fill the superdiagonal entries with the value d. The rest of the matrix is unchanged.
void MatrixRmn::SetSuperDiagonalEntries(double d)
{
- long sDiagLen = tmin(NumRows, (long)(NumCols - 1));
+ long sDiagLen = std::min(NumRows, (long)(NumCols - 1));
double *to = x + NumRows;
for (; sDiagLen > 0; sDiagLen--) {
*to = d;
@@ -91,7 +91,7 @@ void MatrixRmn::SetSuperDiagonalEntries(double d)
// Fill the superdiagonal entries with values in vector d. The rest of the matrix is unchanged.
void MatrixRmn::SetSuperDiagonalEntries(const VectorRn &d)
{
- long sDiagLen = tmin((long)(NumRows - 1), NumCols);
+ long sDiagLen = std::min((long)(NumRows - 1), NumCols);
assert(sDiagLen == d.length);
double *to = x + NumRows;
double *from = d.x;
@@ -104,7 +104,7 @@ void MatrixRmn::SetSuperDiagonalEntries(const VectorRn &d)
// Fill the subdiagonal entries with the value d. The rest of the matrix is unchanged.
void MatrixRmn::SetSubDiagonalEntries(double d)
{
- long sDiagLen = tmin(NumRows, NumCols) - 1;
+ long sDiagLen = std::min(NumRows, NumCols) - 1;
double *to = x + 1;
for (; sDiagLen > 0; sDiagLen--) {
*to = d;
@@ -115,7 +115,7 @@ void MatrixRmn::SetSubDiagonalEntries(double d)
// Fill the subdiagonal entries with values in vector d. The rest of the matrix is unchanged.
void MatrixRmn::SetSubDiagonalEntries(const VectorRn &d)
{
- long sDiagLen = tmin(NumRows, NumCols) - 1;
+ long sDiagLen = std::min(NumRows, NumCols) - 1;
assert(sDiagLen == d.length);
double *to = x + 1;
double *from = d.x;
@@ -262,7 +262,7 @@ double MatrixRmn::DotProductColumn(const VectorRn &v, long colNum) const
// Add a constant to each entry on the diagonal
MatrixRmn &MatrixRmn::AddToDiagonal(double d) // Adds d to each diagonal entry
{
- long diagLen = tmin(NumRows, NumCols);
+ long diagLen = std::min(NumRows, NumCols);
double *dPtr = x;
for (; diagLen > 0; diagLen--) {
*dPtr += d;
@@ -274,7 +274,7 @@ MatrixRmn &MatrixRmn::AddToDiagonal(double d) // Adds d to each diagonal entry
// Aggiunge i temini del vettore alla diagonale
MatrixRmn &MatrixRmn::AddToDiagonal(const VectorRn &v) // Adds d to each diagonal entry
{
- long diagLen = tmin(NumRows, NumCols);
+ long diagLen = std::min(NumRows, NumCols);
double *dPtr = x;
const double *dv = v.x;
for (; diagLen > 0; diagLen--) {
@@ -412,7 +412,7 @@ void MatrixRmn::ConvertToRefNoFree()
// Find row with most non-zero entry.
// Swap to the highest active row
// Subtract appropriately from all the lower rows (row op of type 3)
- long numIters = tmin(NumRows, NumCols);
+ long numIters = std::min(NumRows, NumCols);
double *rowPtr1 = x;
const long diagStep = NumRows + 1;
long lenRowLeft = NumCols;
@@ -528,7 +528,7 @@ void MatrixRmn::PostApplyGivens(double c, double s, long idx1, long idx2)
// ********************************************************************************************
void MatrixRmn::ComputeSVD(MatrixRmn &U, VectorRn &w, MatrixRmn &V) const
{
- assert(U.NumRows == NumRows && V.NumCols == NumCols && U.NumRows == U.NumCols && V.NumRows == V.NumCols && w.GetLength() == tmin(NumRows, NumCols));
+ assert(U.NumRows == NumRows && V.NumCols == NumCols && U.NumRows == U.NumCols && V.NumRows == V.NumCols && w.GetLength() == std::min(NumRows, NumCols));
double temp = 0.0;
VectorRn &superDiag = VectorRn::GetWorkVector(w.GetLength() - 1); // Some extra work space. Will get passed around.
@@ -777,7 +777,7 @@ void MatrixRmn::ConvertBidiagToDiagonal(MatrixRmn &U, MatrixRmn &V, VectorRn &w,
double aa = w.MaxAbs();
double bb = superDiag.MaxAbs();
- double eps = 1.0e-15 * tmax(w.MaxAbs(), superDiag.MaxAbs());
+ double eps = 1.0e-15 * std::max(w.MaxAbs(), superDiag.MaxAbs());
while (true) {
bool workLeft = UpdateBidiagIndices(&firstBidiagIdx, &lastBidiagIdx, w, superDiag, eps);
diff --git a/toonz/sources/toonzlib/imagestyles.cpp b/toonz/sources/toonzlib/imagestyles.cpp
index 0745d5259..2f20a7bb6 100644
--- a/toonz/sources/toonzlib/imagestyles.cpp
+++ b/toonz/sources/toonzlib/imagestyles.cpp
@@ -951,7 +951,7 @@ void TTextureStyle::makeIcon(const TDimension &outputRect)
} else
rTex = m_texture;
- double fitScale = tmin((double)(outputRect.lx) / m_texture->getLx(), (double)(outputRect.ly) / m_texture->getLy());
+ double fitScale = std::min((double)(outputRect.lx) / m_texture->getLx(), (double)(outputRect.ly) / m_texture->getLy());
TAffine affine = TScale(m_params.m_scale * (fitScale)) * TRotation(-m_params.m_rotation);
if (affine != TAffine()) {
diff --git a/toonz/sources/toonzlib/levelupdater.cpp b/toonz/sources/toonzlib/levelupdater.cpp
index 085409c3e..b19f2f610 100644
--- a/toonz/sources/toonzlib/levelupdater.cpp
+++ b/toonz/sources/toonzlib/levelupdater.cpp
@@ -266,7 +266,7 @@ void LevelUpdater::open(TXshSimpleLevel *sl)
assert(levelProperties);
if (levelProperties->hasAlpha() || !existsLevel) {
- int bpp = levelProperties->hasAlpha() ? tmin(32, levelProperties->getBpp()) : levelProperties->getBpp();
+ int bpp = levelProperties->hasAlpha() ? std::min(32, levelProperties->getBpp()) : levelProperties->getBpp();
enforceBpp(m_pg, bpp, existsLevel);
}
diff --git a/toonz/sources/toonzlib/movierenderer.cpp b/toonz/sources/toonzlib/movierenderer.cpp
index 85a1204d1..765256ff0 100644
--- a/toonz/sources/toonzlib/movierenderer.cpp
+++ b/toonz/sources/toonzlib/movierenderer.cpp
@@ -79,7 +79,7 @@ void getRange(ToonzScene *scene, bool isPreview, int &from, int &to)
int r0, r1;
xs->getCellRange(k, r0, r1);
- from = tmin(from, r0), to = tmax(to, r1);
+ from = std::min(from, r0), to = std::max(to, r1);
}
}
}
@@ -297,7 +297,7 @@ void MovieRenderer::Imp::addSoundtrack(int r0, int r1, double fps)
// Then, add the rest
TINT32 fromSample = m_st->getSampleCount();
- TINT32 numSample = tmax(TINT32((r1 - r0 + 1) * samplePerFrame),
+ TINT32 numSample = std::max(TINT32((r1 - r0 + 1) * samplePerFrame),
snd1->getSampleCount());
m_st = TSop::insertBlank(m_st, fromSample, numSample + m_whiteSample);
@@ -426,8 +426,8 @@ void MovieRenderer::Imp::doRenderRasterCompleted(const RenderData &renderData)
TLevelP oldLevel(m_levelUpdaterA->getInputLevel());
if (oldLevel) {
- from = tmin(from, oldLevel->begin()->first.getNumber() - 1);
- to = tmax(to, (--oldLevel->end())->first.getNumber() - 1);
+ from = std::min(from, oldLevel->begin()->first.getNumber() - 1);
+ to = std::max(to, (--oldLevel->end())->first.getNumber() - 1);
}
addSoundtrack(from, to, m_scene->getProperties()->getOutputProperties()->getFrameRate());
diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp
index 6137c4610..078623d77 100644
--- a/toonz/sources/toonzlib/palettecmd.cpp
+++ b/toonz/sources/toonzlib/palettecmd.cpp
@@ -632,7 +632,7 @@ void PaletteCmd::eraseStyles(const std::set<TXshSimpleLevel *> &levels,
static void restoreImages(LevelImages &levelImages)
{
- int f, fCount = tmin(levelImages.first->getFrameCount(), int(levelImages.second.size()));
+ int f, fCount = std::min(levelImages.first->getFrameCount(), int(levelImages.second.size()));
for (f = 0; f != fCount; ++f)
restoreImage(levelImages.first, f, levelImages.second[f]);
diff --git a/toonz/sources/toonzlib/rasterstrokegenerator.cpp b/toonz/sources/toonzlib/rasterstrokegenerator.cpp
index de8ddc054..989020e99 100644
--- a/toonz/sources/toonzlib/rasterstrokegenerator.cpp
+++ b/toonz/sources/toonzlib/rasterstrokegenerator.cpp
@@ -203,7 +203,7 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out, const TRasterCM32
outPix->setTone(255);
}
} else if (inPix->getTone() < 255 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
- outPix->setTone(tmax(outPix->getTone(), 255 - inPix->getTone()));
+ outPix->setTone(std::max(outPix->getTone(), 255 - inPix->getTone()));
}
}
if (m_colorType == PAINT) {
@@ -218,7 +218,7 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out, const TRasterCM32
outPix->setTone(255);
}
} else if (inPix->getTone() < 255 && (!m_selective || (m_selective && outPix->getInk() == m_selectedStyle))) {
- outPix->setTone(tmax(outPix->getTone(), 255 - inPix->getTone()));
+ outPix->setTone(std::max(outPix->getTone(), 255 - inPix->getTone()));
}
}
} else if (m_task == PAINTBRUSH) {
diff --git a/toonz/sources/toonzlib/sandor_fxs/CIL.cpp b/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
index 09912759e..309c35e35 100644
--- a/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
@@ -13,6 +13,8 @@
#include "SDef.h"
#include "CIL.h"
+#include <algorithm>
+
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
@@ -69,9 +71,9 @@ void CCIL::strToColorIndex(const char *s, CCIL &cil,
int begin = getRangeBegin(s);
int end = getRangeEnd(s);
if (begin >= 0 && end >= 0) {
- begin = MIN(begin, maxIndex);
- end = MIN(end, maxIndex);
- for (int i = MIN(begin, end); i <= MAX(begin, end) && cil.m_nb < MAXNBCI; i++)
+ begin = std::min(begin, maxIndex);
+ end = std::min(end, maxIndex);
+ for (int i = std::min(begin, end); i <= std::max(begin, end) && cil.m_nb < MAXNBCI; i++)
cil.m_ci[cil.m_nb++] = i;
}
} else {
diff --git a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
index 3d98a54eb..a14a8caa8 100644
--- a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
@@ -195,10 +195,10 @@ void CPattern::getBBox(SRECT &bb)
for (int y = 0; y < m_lY; y++)
for (int x = 0; x < m_lX; x++, pPic++)
if (pPic->m > (UCHAR)0) {
- bb.x0 = MIN(bb.x0, x);
- bb.y0 = MIN(bb.y0, y);
- bb.x1 = MAX(bb.x1, x);
- bb.y1 = MAX(bb.y1, y);
+ bb.x0 = std::min(bb.x0, x);
+ bb.y0 = std::min(bb.y0, y);
+ bb.x1 = std::max(bb.x1, x);
+ bb.y1 = std::max(bb.y1, y);
}
}
diff --git a/toonz/sources/toonzlib/sandor_fxs/Pattern.h b/toonz/sources/toonzlib/sandor_fxs/Pattern.h
index 2a3055d32..f9e6db105 100644
--- a/toonz/sources/toonzlib/sandor_fxs/Pattern.h
+++ b/toonz/sources/toonzlib/sandor_fxs/Pattern.h
@@ -91,10 +91,10 @@ public:
bool isUC = pic.getType() == ST_RGBM ? true : false;
double maxPixVal = isUC ? 255.0 : 65535.0;
double ddiv = 1.0 / (maxPixVal * 255.0);
- int yBeg = MAX(yy - iSDiag2, 0);
- int yEnd = MIN(yy + iSDiag2, pic.m_lY - 1);
- int xBeg = MAX(xx - iSDiag2, 0);
- int xEnd = MIN(xx + iSDiag2, pic.m_lX - 1);
+ int yBeg = std::max(yy - iSDiag2, 0);
+ int yEnd = std::min(yy + iSDiag2, pic.m_lY - 1);
+ int xBeg = std::max(xx - iSDiag2, 0);
+ int xEnd = std::min(xx + iSDiag2, pic.m_lX - 1);
double lxm105 = (double)(m_lX - 1) * 0.5;
double lym105 = (double)(m_lY - 1) * 0.5;
@@ -179,87 +179,6 @@ public:
}
}
}
-
- /* Optimized version. Doesn't use the ROTATION parameter.
- !!! Semi-finished version !!!
-template<class P>
-void mapIt(CSTColSelPic<P>& pic, const CSTColSelPic<P>& oriPic,
- const int xx, const int yy,
- const double scale, const bool isUseOriColor)
-{
-
- if ( scale<0.01 )
- return;
-
- double scaleInv=1.0/scale;
- double sDiag=scale*sqrt(m_lX*m_lX+m_lY*m_lY);
- int iSDiag=(int)sDiag+1;
- int iSDiag2=iSDiag/2+1;
- if ( iSDiag<=0 )
- return;
-
- bool isUC= pic.getType()==ST_RGBM ? true : false;
- double maxPixVal= isUC ? 255.0 : 65535.0;
-
- int yBeg=MAX(yy-iSDiag2,0);
- int yEnd=MIN(yy+iSDiag2,pic.m_lY-1);
- int xBeg=MAX(xx-iSDiag2,0);
- int xEnd=MIN(xx+iSDiag2,pic.m_lX-1);
- I_PIXEL eCol;
- for( int y=yBeg; y<=yEnd; y++ )
- for( int x=xBeg; x<=xEnd; x++ )
- if ( x>=0 && x<pic.m_lX && y>=0 && y<pic.m_lY ) {
-// Gets the pointer to the proper pattern pixel
- UC_PIXEL* pPatPixel=0;
- double dxx=(double)(x-xx)*scaleInv+(double)(m_lX-1)*0.5;
- double dyy=(double)(y-yy)*scaleInv+(double)(m_lY-1)*0.5;
- int x1=I_ROUND(dxx);
- int y1=I_ROUND(dyy);
- if ( x1>=0 && x1<m_lX && y1>=0 && y1<m_lY ) {
- pPatPixel=m_pat+y1*m_lX+x1;
- pPatPixel= pPatPixel->m>(UCHAR)0 ? pPatPixel : 0;
- }
-
-// getMapPixel(x-xx,y-yy,scale,ucp);
- if ( pPatPixel ) {
- int xy=y*pic.m_lX+x;
- P* pPic=pic.m_pic+xy;
- P* pOriPic=oriPic+xy;
- if ( isUseOriColor ) {
- eCol.r=(int)pOriPic->r;
- eCol.g=(int)pOriPic->g;
- eCol.b=(int)pOriPic->b;
- eCol.m=(int)pOriPic->m;
- } else {
- eCol.r=(int)pPat->r;
- eCol.g=(int)pPat->g;
- eCol.b=(int)pPat->b;
- eCol.m=(int)pPat->m;
- }
- double q= ((double)pPatPixel->m/255.0)*((double)eCol.m/maxPixVal);
- double r=(1.0-q)*(double)pPic->r+q*(double)eCol.r;
- double g=(1.0-q)*(double)pPic->g+q*(double)eCol.g;
- double b=(1.0-q)*(double)pPic->b+q*(double)eCol.b;
- double m=(1.0-q)*(double)pPic->m+q*(double)eCol.m;
- r=D_CUT(r,0.0,maxPixVal);
- g=D_CUT(g,0.0,maxPixVal);
- b=D_CUT(b,0.0,maxPixVal);
- m=D_CUT(m,0.0,maxPixVal);
- if ( isUC ) {
- pPic->r=UC_ROUND(r);
- pPic->g=UC_ROUND(g);
- pPic->b=UC_ROUND(b);
- pPic->m=UC_ROUND(m);
- } else {
- pPic->r=US_ROUND(r);
- pPic->g=US_ROUND(g);
- pPic->b=US_ROUND(b);
- pPic->m=US_ROUND(m);
- }
- }
- }
-}
-*/
};
#endif // !defined(AFX_PATTERN_H__8E417023_35C0_11D6_B9EA_0040F674BE6A__INCLUDED_)
diff --git a/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp b/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
index 74ecf2b2a..a317cc1a0 100644
--- a/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
@@ -38,17 +38,17 @@ CPatternMapParam::CPatternMapParam(const int argc, const char *argv[],
m_ink.set(argv[0], 4095);
- m_maxScale = MAX(atof(argv[1]) * scale, atof(argv[2]) * scale);
- m_minScale = MIN(atof(argv[1]) * scale, atof(argv[2]) * scale);
+ m_maxScale = std::max(atof(argv[1]) * scale, atof(argv[2]) * scale);
+ m_minScale = std::min(atof(argv[1]) * scale, atof(argv[2]) * scale);
- m_maxDirAngle = MAX(atof(argv[3]), atof(argv[4]));
- m_minDirAngle = MIN(atof(argv[3]), atof(argv[4]));
+ m_maxDirAngle = std::max(atof(argv[3]), atof(argv[4]));
+ m_minDirAngle = std::min(atof(argv[3]), atof(argv[4]));
m_isRandomDir = atoi(argv[5]) > 0 ? true : false;
- double dmax = MAX(atof(argv[6]) * scale, 1.0);
- double dmin = MAX(atof(argv[7]) * scale, 1.0);
- m_maxDist = MAX(dmax, dmin);
- m_minDist = MIN(dmax, dmin);
+ double dmax = std::max(atof(argv[6]) * scale, 1.0);
+ double dmin = std::max(atof(argv[7]) * scale, 1.0);
+ m_maxDist = std::max(dmax, dmin);
+ m_minDist = std::min(dmax, dmin);
m_density = shrink > 0 ? atof(argv[8]) * (double)shrink : atof(argv[8]);
m_isKeepContour = atoi(argv[9]) > 0 ? true : false;
diff --git a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
index 62879b584..f80febea4 100644
--- a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
@@ -152,10 +152,10 @@ void CPatternPosition::sel0255To01(const int lX, const int lY, UCHAR *sel, SRECT
for (int x = 0; x < lX; x++, pSel++)
if (*pSel >= (UCHAR)1) {
*pSel = (UCHAR)1;
- bb.x0 = MIN(x, bb.x0);
- bb.x1 = MAX(x, bb.x1);
- bb.y0 = MIN(y, bb.y0);
- bb.y1 = MAX(y, bb.y1);
+ bb.x0 = std::min(x, bb.x0);
+ bb.x1 = std::max(x, bb.x1);
+ bb.y0 = std::min(y, bb.y0);
+ bb.y1 = std::max(y, bb.y1);
}
}
diff --git a/toonz/sources/toonzlib/sandor_fxs/SDef.h b/toonz/sources/toonzlib/sandor_fxs/SDef.h
index a45c564b6..731302ff3 100644
--- a/toonz/sources/toonzlib/sandor_fxs/SDef.h
+++ b/toonz/sources/toonzlib/sandor_fxs/SDef.h
@@ -75,13 +75,6 @@ typedef struct {
double d;
} SXYD;
-#ifndef MIN
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#endif
-#ifndef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-#endif
-
#define I_ROUND(x) ((int)(((int)(-0.9F) == 0 && (x) < 0.0F) ? ((x)-0.5F) : ((x) + 0.5F)))
#define I_ROUNDP(x) ((int)((x) + 0.5F))
#define UC_ROUND(x) ((unsigned char)((x) + 0.5F))
diff --git a/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp b/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
index 3b24878a1..c554afa4e 100644
--- a/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/SDirection.cpp
@@ -114,7 +114,7 @@ CSDirection::~CSDirection()
double CSDirection::adjustAngle(const short sum[4], const int Ima,
const int Im45, const int Ip45)
{
- short ma = MAX(sum[Im45], sum[Ip45]);
+ short ma = std::max(sum[Im45], sum[Ip45]);
if (ma < 0)
return 0.0;
@@ -188,7 +188,7 @@ UCHAR CSDirection::getDir(const int xx, const int yy, UCHAR *sel)
}
if (w == 0)
return 0;
- short ma = MAX(MAX(MAX(sum[0], sum[1]), sum[2]), sum[3]);
+ short ma = std::max({sum[0], sum[1], sum[2], sum[3]});
double angle = getAngle(sum, ma);
//tmsg_info(" - dir - %d, %d, %d, %d angle=%f", sum[0],sum[1],sum[2],sum[3],
// angle-50.0);
diff --git a/toonz/sources/toonzlib/sandor_fxs/blend.cpp b/toonz/sources/toonzlib/sandor_fxs/blend.cpp
index a2c0a6bb4..b70fc76a5 100644
--- a/toonz/sources/toonzlib/sandor_fxs/blend.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/blend.cpp
@@ -67,7 +67,7 @@ BlurPattern::BlurPattern(double distance, unsigned int samplesCount, bool radial
for (i = 0; i < samplesCount; ++i) {
TPoint &sample = m_samples[i];
- int l = tmax(abs(sample.x), abs(sample.y));
+ int l = std::max(abs(sample.x), abs(sample.y));
m_samplePaths[i].reserve(l);
@@ -598,7 +598,7 @@ void blend(TToonzImageP ti, TRasterPT<PIXEL> rasOut, const std::vector<BlendPara
for (i = 0; i < params.size(); ++i)
for (j = 0; j < params[i].colorsIndexes.size(); ++j)
if (params[i].colorsIndexes[j] == 0)
- enlargement = tmax(enlargement, tceil(params[i].intensity));
+ enlargement = std::max(enlargement, tceil(params[i].intensity));
saveBox = saveBox.enlarge(enlargement);
TRasterCM32P cmIn(ti->getRaster()->extract(saveBox));
diff --git a/toonz/sources/toonzlib/strokegenerator.cpp b/toonz/sources/toonzlib/strokegenerator.cpp
index 96e89234a..6810cc09a 100644
--- a/toonz/sources/toonzlib/strokegenerator.cpp
+++ b/toonz/sources/toonzlib/strokegenerator.cpp
@@ -40,12 +40,12 @@ void StrokeGenerator::add(const TThickPoint &point, double pixelSize2)
TThickPoint lastPoint = m_points.back();
if (tdistance2(lastPoint, point) >= 4 * pixelSize2) {
m_points.push_back(point);
- double d = tmax(point.thick, lastPoint.thick) + 3;
+ double d = std::max(point.thick, lastPoint.thick) + 3;
TRectD rect(TRectD(lastPoint, point).enlarge(d));
m_modifiedRegion += rect;
m_lastModifiedRegion += rect;
} else {
- m_points.back().thick = tmax(m_points.back().thick, point.thick);
+ m_points.back().thick = std::max(m_points.back().thick, point.thick);
}
}
}
@@ -61,7 +61,7 @@ void StrokeGenerator::filterPoints()
// si hanno tra m_points[0] (al massimo m_points[1]) e i successivi)
int size1 = m_points.size();
int kMin = 0;
- int kMax = tmin(4, size1 - 2); // confronta 5 m_points iniziali con i successivi corrispondenti
+ int kMax = std::min(4, size1 - 2); // confronta 5 m_points iniziali con i successivi corrispondenti
int k = kMax;
for (k = kMax; k >= kMin; --k) {
TThickPoint currPoint = m_points[k];
@@ -81,7 +81,7 @@ void StrokeGenerator::filterPoints()
// si hanno tra m_points[size - 1] (al massimo m_points[size - 2]) e i predecessori)
int size2 = m_points.size();
kMax = size2 - 1;
- kMin = tmax(kMax - 4, 1); // confronta 5 m_points finali con i predecessori corrispondenti
+ kMin = std::max(kMax - 4, 1); // confronta 5 m_points finali con i predecessori corrispondenti
k = kMin;
for (k = kMin; k <= kMax; ++k) {
TThickPoint currPoint = m_points[k];
@@ -171,7 +171,7 @@ void StrokeGenerator::drawLastFragments()
drawFragments(i, n - 1);
- m_paintedPointCount = tmax(0, n - 2);
+ m_paintedPointCount = std::max(0, n - 2);
}
//-------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/stylemanager.cpp b/toonz/sources/toonzlib/stylemanager.cpp
index 8e4087c27..32fc74e64 100644
--- a/toonz/sources/toonzlib/stylemanager.cpp
+++ b/toonz/sources/toonzlib/stylemanager.cpp
@@ -108,7 +108,7 @@ void CustomStyleManager::StyleLoaderTask::run()
TRectD bbox = img->getBBox();
double scx = 0.8 * chipSize.lx / bbox.getLx();
double scy = 0.8 * chipSize.ly / bbox.getLy();
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
double dx = 0.5 * chipSize.lx;
double dy = 0.5 * chipSize.ly;
diff --git a/toonz/sources/toonzlib/tcamera.cpp b/toonz/sources/toonzlib/tcamera.cpp
index 90ce47aed..9dd69c6c6 100644
--- a/toonz/sources/toonzlib/tcamera.cpp
+++ b/toonz/sources/toonzlib/tcamera.cpp
@@ -126,10 +126,10 @@ void TCamera::setInterestRect(const TRect &rect)
//the default (empty) rect. We want to maintain the coordinates instead.
//m_interestRect = rect * TRect(m_res);
- m_interestRect.x0 = tmax(rect.x0, 0);
- m_interestRect.y0 = tmax(rect.y0, 0);
- m_interestRect.x1 = tmin(rect.x1, m_res.lx - 1);
- m_interestRect.y1 = tmin(rect.y1, m_res.ly - 1);
+ m_interestRect.x0 = std::max(rect.x0, 0);
+ m_interestRect.y0 = std::max(rect.y0, 0);
+ m_interestRect.x1 = std::min(rect.x1, m_res.lx - 1);
+ m_interestRect.y1 = std::min(rect.y1, m_res.ly - 1);
}
//-------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/tcenterlineadjustments.cpp b/toonz/sources/toonzlib/tcenterlineadjustments.cpp
index 856f881a4..b56da00a6 100644
--- a/toonz/sources/toonzlib/tcenterlineadjustments.cpp
+++ b/toonz/sources/toonzlib/tcenterlineadjustments.cpp
@@ -549,7 +549,7 @@ inline bool checkCircles(std::vector<double> &heights)
test_against_max_height:
//Reusing cos
- cos = (sin < 0.1) ? tmax(heights[i], heights[j]) : norm((vi * (heights[j] / sin)) + (vj * (heights[i] / sin)));
+ cos = (sin < 0.1) ? std::max(heights[i], heights[j]) : norm((vi * (heights[j] / sin)) + (vj * (heights[i] / sin)));
if (cos < hMax)
return 0;
}
@@ -576,7 +576,7 @@ inline void tryConfiguration(const std::vector<unsigned int> &bounds)
mean /= end - first;
//Check if the distance from extremities to mean is tolerable
- if (tmax((*currEnterings)[(*heightIndicesPtr)[end - 1]].m_height - mean,
+ if (std::max((*currEnterings)[(*heightIndicesPtr)[end - 1]].m_height - mean,
mean - (*currEnterings)[(*heightIndicesPtr)[first]].m_height) > hDiffMul * mean)
return;
@@ -791,7 +791,7 @@ inline bool JunctionArea::sequencesPullBack()
P = planeProjection(*a->m_graphHolder->getNode(i));
if (tdistance(P, a->m_direction, m_newJointPosition) >
- tmax(pullBackMul * a->m_height, 1.0))
+ std::max(pullBackMul * a->m_height, 1.0))
return 0; //Pull back failed
}
diff --git a/toonz/sources/toonzlib/tcenterlinecolors.cpp b/toonz/sources/toonzlib/tcenterlinecolors.cpp
index dc32ab3ce..6b2063a9e 100644
--- a/toonz/sources/toonzlib/tcenterlinecolors.cpp
+++ b/toonz/sources/toonzlib/tcenterlinecolors.cpp
@@ -165,7 +165,7 @@ void sampleColor(const TRasterCM32P &ras, int threshold, Sequence &seq, Sequence
int paramCount = params.size(),
paramMax = paramCount - 1;
- int sampleMax = tmax(params.back() / tmax(meanThickness, 1.0), 3.0), // Number of color samples depends on
+ int sampleMax = std::max(params.back() / std::max(meanThickness, 1.0), 3.0), // Number of color samples depends on
sampleCount = sampleMax + 1; // the ratio params.back() / meanThickness
std::vector<double> sampleParams(sampleCount); // Sampling lengths
@@ -184,8 +184,8 @@ void sampleColor(const TRasterCM32P &ras, int threshold, Sequence &seq, Sequence
T3DPointD samplePoint(*currGraph->getNode(nodes[j]) * (1 - t) + *currGraph->getNode(nodes[j + 1]) * t);
sampleParams[s] = samplePar;
- samplePoints[s] = TPoint(tmin(samplePoint.x, double(ras->getLx() - 1)), // This deals with sample points at
- tmin(samplePoint.y, double(ras->getLy() - 1))); // the top/right raster border
+ samplePoints[s] = TPoint(std::min(samplePoint.x, double(ras->getLx() - 1)), // This deals with sample points at
+ std::min(samplePoint.y, double(ras->getLy() - 1))); // the top/right raster border
sampleSegments[s] = j;
}
@@ -423,12 +423,12 @@ int getInkPredominance(const TRasterCM32P &ras, TPalette *palette, int x, int y,
int mx, my, Mx, My;
std::vector<int> inksFound(palette->getStyleCount());
- radius = tmin(radius, 7); //Restrict radius for a minimum significative neighbour
+ radius = std::min(radius, 7); //Restrict radius for a minimum significative neighbour
- mx = tmax(x - radius, 0);
- my = tmax(y - radius, 0);
- Mx = tmin(x + radius, ras->getLx() - 1);
- My = tmin(y + radius, ras->getLy() - 1);
+ mx = std::max(x - radius, 0);
+ my = std::max(y - radius, 0);
+ Mx = std::min(x + radius, ras->getLx() - 1);
+ My = std::min(y + radius, ras->getLy() - 1);
//Check square grid around (x,y)
for (i = mx; i <= Mx; ++i)
diff --git a/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp b/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp
index d21aafbab..b85fd85a5 100644
--- a/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp
+++ b/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp
@@ -132,7 +132,7 @@ inline unsigned char PixelEvaluator<TPixel32>::getBlackOrWhite(int x, int y)
//NOTE: Green is considered twice brighter than red or blue channel.
//Using Value of HSV color model
- return tmax(m_ras->pixels(y)[x].r, tmax(m_ras->pixels(y)[x].g, m_ras->pixels(y)[x].b)) <
+ return std::max(m_ras->pixels(y)[x].r, std::max(m_ras->pixels(y)[x].g, m_ras->pixels(y)[x].b)) <
m_threshold * (m_ras->pixels(y)[x].m / 255.0);
//Using Lightness of HSV color model
diff --git a/toonz/sources/toonzlib/tcenterlinetostrokes.cpp b/toonz/sources/toonzlib/tcenterlinetostrokes.cpp
index 07c063fb0..9d6e2acb7 100644
--- a/toonz/sources/toonzlib/tcenterlinetostrokes.cpp
+++ b/toonz/sources/toonzlib/tcenterlinetostrokes.cpp
@@ -166,7 +166,7 @@ SequenceSimplifier::lengthOf(UINT a, UINT aLink, UINT b)
for (; curr != b; m_s->advance(old, curr)) {
d = tdistance2(*m_graph->getNode(curr), v, *m_graph->getNode(a));
- if (d > tmin(m_graph->getNode(curr)->z * Polyg_eps_mul, Polyg_eps_max)) {
+ if (d > std::min(m_graph->getNode(curr)->z * Polyg_eps_mul, Polyg_eps_max)) {
res.infty();
return res;
} else
@@ -614,7 +614,7 @@ bool SequenceConverter::penalty(unsigned int a, unsigned int b, Length &len)
//Confronting 4th power of error with mean polygonal thickness
// - can be changed
- p_max = tmin(sqrt(p_max) * m_penalty, Quad_eps_max);
+ p_max = std::min(sqrt(p_max) * m_penalty, Quad_eps_max);
//CP only integral
p = (ellProd(CPs[0], CPs[0]) + 2 * ellProd(CPs[2], CPs[2]) + ellProd(CPs[4], CPs[4]) +
diff --git a/toonz/sources/toonzlib/tcleanupper.cpp b/toonz/sources/toonzlib/tcleanupper.cpp
index 368cff5c6..f9c259c7f 100644
--- a/toonz/sources/toonzlib/tcleanupper.cpp
+++ b/toonz/sources/toonzlib/tcleanupper.cpp
@@ -125,8 +125,8 @@ HSVColor HSVColor::fromRGB(double r, double g, double b)
double h, s, v;
double max, min, delta;
- max = tmax(r, g, b);
- min = tmin(r, g, b);
+ max = std::max({r, g, b});
+ min = std::min({r, g, b});
v = max;
@@ -209,7 +209,7 @@ class TransfFunction
for (i = 0; i <= p1; i++)
TransfFun[pencil << 8 | i] = 0;
for (; i < p2; i++)
- TransfFun[pencil << 8 | i] = tmin(max, max * (i - p1) / cont);
+ TransfFun[pencil << 8 | i] = std::min(max, max * (i - p1) / cont);
for (; i < 256; i++)
TransfFun[pencil << 8 | i] = max;
}
@@ -218,7 +218,7 @@ public:
TransfFunction(const TargetColors &colors)
{
memset(TransfFun, 0, sizeof TransfFun);
- int count = tmin(colors.getColorCount(), MAX_N_PENCILS);
+ int count = std::min(colors.getColorCount(), MAX_N_PENCILS);
for (int p = 0; p < count; p++) {
int brightness = troundp(2.55 * colors.getColor(p).m_brightness);
int contrast = troundp(2.55 * colors.getColor(p).m_contrast);
@@ -1017,7 +1017,7 @@ inline void preprocessColor(const TPixel32 &pix, const TargetColorData &blackCol
//Retrieve the hue distance and, in case it's less than current one, this idx better
//approximates the color.
- newHDist = (pixHSV.m_h > fColor.m_hsv.m_h) ? tmin(pixHSV.m_h - fColor.m_hsv.m_h, fColor.m_hsv.m_h - pixHSV.m_h + 360.0) : tmin(fColor.m_hsv.m_h - pixHSV.m_h, pixHSV.m_h - fColor.m_hsv.m_h + 360.0);
+ newHDist = (pixHSV.m_h > fColor.m_hsv.m_h) ? std::min(pixHSV.m_h - fColor.m_hsv.m_h, fColor.m_hsv.m_h - pixHSV.m_h + 360.0) : std::min(fColor.m_hsv.m_h - pixHSV.m_h, pixHSV.m_h - fColor.m_hsv.m_h + 360.0);
if (newHDist < hDist) {
hDist = newHDist;
idx = i;
diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp
index af6f86378..1b097e5e5 100644
--- a/toonz/sources/toonzlib/tcolumnfx.cpp
+++ b/toonz/sources/toonzlib/tcolumnfx.cpp
@@ -274,7 +274,7 @@ int getEnlargement(const std::vector<TRasterFxRenderDataP> &fxs, double scale)
{
ArtAtContourParams &params = sandorData->m_contourParams;
enlargement =
- tmax(tceil(sandorData->m_controllerBBox.getLx()), tceil(sandorData->m_controllerBBox.getLy())) *
+ std::max(tceil(sandorData->m_controllerBBox.getLx()), tceil(sandorData->m_controllerBBox.getLy())) *
params.m_maxSize;
break;
diff --git a/toonz/sources/toonzlib/tdistort.cpp b/toonz/sources/toonzlib/tdistort.cpp
index b3921e3d4..4397c550f 100644
--- a/toonz/sources/toonzlib/tdistort.cpp
+++ b/toonz/sources/toonzlib/tdistort.cpp
@@ -243,8 +243,8 @@ template <typename PIXEL, typename CHANNEL_TYPE>
PIXEL filterPixel(double a, double b, PIXEL *lineSrc, int lineLength, int lineWrap)
{
//Retrieve the interesting pixel interval
- double x0 = tmax(a, 0.0);
- double x1 = tmin(b, (double)lineLength);
+ double x0 = std::max(a, 0.0);
+ double x1 = std::min(b, (double)lineLength);
int x0Floor = tfloor(x0);
int x0Ceil = tceil(x0);
@@ -329,8 +329,8 @@ PIXEL filterPixel(double a, double b, double c, double d, const TRasterPT<PIXEL>
}
//Now, filter each column in [a, b]
- double x0 = tmax(a, 0.0);
- double x1 = tmin(b, (double)rasIn->getLx());
+ double x0 = std::max(a, 0.0);
+ double x1 = std::min(b, (double)rasIn->getLx());
if (x0 >= x1)
return PIXEL::Transparent;
@@ -395,7 +395,7 @@ void resample(const TRasterPT<T> &rasIn, TRasterPT<T> &rasOut, const TDistorter
for (int x = 0; x < rasOut->getLx(); currOldInv += invsCount, currNewInv += invsCount, ++x, ++pix) {
T pixDown(0, 0, 0, 0);
- int count = tmin(oldCounts[x], oldCounts[x + 1], newCounts[x]);
+ int count = std::min({oldCounts[x], oldCounts[x + 1], newCounts[x]});
for (int i = 0; i < count; ++i) {
T pixUp(0, 0, 0, 0);
@@ -820,8 +820,9 @@ TRectD PerspectiveDistorter::TPerspect::operator*(const TRectD &rect) const
p2 = *this * rect.getP01(),
p3 = *this * rect.getP10(),
p4 = *this * rect.getP11();
- return TRectD(tmin(p1.x, p2.x, p3.x, p4.x), tmin(p1.y, p2.y, p3.y, p4.y),
- tmax(p1.x, p2.x, p3.x, p4.x), tmax(p1.y, p2.y, p3.y, p4.y));
+ return TRectD(
+ std::min({p1.x, p2.x, p3.x, p4.x}), std::min({p1.y, p2.y, p3.y, p4.y}),
+ std::max({p1.x, p2.x, p3.x, p4.x}), std::max({p1.y, p2.y, p3.y, p4.y}));
} else
return TConsts::infiniteRectD;
}
@@ -855,8 +856,8 @@ void PerspectiveDistorter::computeMatrix()
//and inverting makes squares with respect to their elements' size, we'd better put the
//quadrilaterals in more numerically stable references before inversions.
- double srcSize = tmax(dist(m_p00s, m_p10s), dist(m_p00s, m_p01s), dist(m_p10s, m_p11s), dist(m_p01s, m_p11s));
- double dstSize = tmax(dist(m_p00d, m_p10d), dist(m_p00d, m_p01d), dist(m_p10d, m_p11d), dist(m_p01d, m_p11d));
+ double srcSize = std::max({dist(m_p00s, m_p10s), dist(m_p00s, m_p01s), dist(m_p10s, m_p11s), dist(m_p01s, m_p11s)});
+ double dstSize = std::max({dist(m_p00d, m_p10d), dist(m_p00d, m_p01d), dist(m_p10d, m_p11d), dist(m_p01d, m_p11d)});
TAffine toSrcNormalizedRef(TScale(1.0 / srcSize) * TTranslation(-m_p00s));
TAffine toSrcRef(TTranslation(m_p00s) * TScale(srcSize));
@@ -997,29 +998,29 @@ inline void updateResult(
//Rect lies on one side of the derivative line extension. Therefore, the
//inverted rect can be updated.
if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0)
- posResult.y0 = tmin(posResult.y0, srcCorner.y - securityAddendum);
+ posResult.y0 = std::min(posResult.y0, srcCorner.y - securityAddendum);
else
- posResult.y1 = tmax(posResult.y1, srcCorner.y + securityAddendum);
+ posResult.y1 = std::max(posResult.y1, srcCorner.y + securityAddendum);
if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY)
if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0)
- posResult.x1 = tmax(posResult.x1, srcCorner.x + securityAddendum);
+ posResult.x1 = std::max(posResult.x1, srcCorner.x + securityAddendum);
else
- posResult.x0 = tmin(posResult.x0, srcCorner.x - securityAddendum);
+ posResult.x0 = std::min(posResult.x0, srcCorner.x - securityAddendum);
} else if (jacobianSign < 0) {
hasNegativeResults = true;
if (sideDerXAgainstRectSideX != -sideDerXAgainstRectSideY)
if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0)
- negResult.y1 = tmax(posResult.y1, srcCorner.y + securityAddendum);
+ negResult.y1 = std::max(posResult.y1, srcCorner.y + securityAddendum);
else
- negResult.y0 = tmin(posResult.y0, srcCorner.y - securityAddendum);
+ negResult.y0 = std::min(posResult.y0, srcCorner.y - securityAddendum);
if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY)
if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0)
- negResult.x0 = tmin(posResult.x0, srcCorner.x - securityAddendum);
+ negResult.x0 = std::min(posResult.x0, srcCorner.x - securityAddendum);
else
- negResult.x1 = tmax(posResult.x1, srcCorner.x + securityAddendum);
+ negResult.x1 = std::max(posResult.x1, srcCorner.x + securityAddendum);
}
}
@@ -1121,10 +1122,10 @@ TRectD BilinearDistorter::invMap(const TRectD &rect) const
for (i = 0; i < 4; ++i) {
for (j = 0; j < count[i]; ++j) {
TPointD &inv(invs[j + 2 * i]);
- bbox.x0 = tmin(bbox.x0, inv.x);
- bbox.y0 = tmin(bbox.y0, inv.y);
- bbox.x1 = tmax(bbox.x1, inv.x);
- bbox.y1 = tmax(bbox.y1, inv.y);
+ bbox.x0 = std::min(bbox.x0, inv.x);
+ bbox.y0 = std::min(bbox.y0, inv.y);
+ bbox.x1 = std::max(bbox.x1, inv.x);
+ bbox.y1 = std::max(bbox.y1, inv.y);
}
}
@@ -1136,10 +1137,10 @@ TRectD BilinearDistorter::invMap(const TRectD &rect) const
invs[2] = m_refToSource.map(bbox.getP01());
invs[3] = m_refToSource.map(bbox.getP11());
- bbox.x0 = tmin(invs[0].x, invs[1].x, invs[2].x, invs[3].x);
- bbox.y0 = tmin(invs[0].y, invs[1].y, invs[2].y, invs[3].y);
- bbox.x1 = tmax(invs[0].x, invs[1].x, invs[2].x, invs[3].x);
- bbox.y1 = tmax(invs[0].y, invs[1].y, invs[2].y, invs[3].y);
+ bbox.x0 = std::min({invs[0].x, invs[1].x, invs[2].x, invs[3].x});
+ bbox.y0 = std::min({invs[0].y, invs[1].y, invs[2].y, invs[3].y});
+ bbox.x1 = std::max({invs[0].x, invs[1].x, invs[2].x, invs[3].x});
+ bbox.y1 = std::max({invs[0].y, invs[1].y, invs[2].y, invs[3].y});
return bbox.enlarge(5); //Enlarge a little just to be sure
}
diff --git a/toonz/sources/toonzlib/texturemanager.cpp b/toonz/sources/toonzlib/texturemanager.cpp
index 9b7f342c7..fc7a18b0b 100644
--- a/toonz/sources/toonzlib/texturemanager.cpp
+++ b/toonz/sources/toonzlib/texturemanager.cpp
@@ -65,7 +65,7 @@ TDimensionI TextureManager::getMaxSize(bool isRGBM)
int s = Preferences::instance()->getTextureSize();
if (s)
- s = tmin(s, 64 << (shift - 1));
+ s = std::min(s, 64 << (shift - 1));
else
s = 64 << (shift - 1);
m_textureSize.lx = s;
@@ -73,7 +73,7 @@ TDimensionI TextureManager::getMaxSize(bool isRGBM)
glDisable(GL_TEXTURE_2D);
}
- return TDimension(tmin(m_textureSize.lx, 2048), tmin(m_textureSize.ly, 2048));
+ return TDimension(std::min(m_textureSize.lx, 2048), std::min(m_textureSize.ly, 2048));
}
#else
TDimension TextureManager::getMaxSize(bool isRGBM)
diff --git a/toonz/sources/toonzlib/toonzimageutils.cpp b/toonz/sources/toonzlib/toonzimageutils.cpp
index 5f597068d..544e53266 100644
--- a/toonz/sources/toonzlib/toonzimageutils.cpp
+++ b/toonz/sources/toonzlib/toonzimageutils.cpp
@@ -170,7 +170,7 @@ void fastAddPaintRegion(const TToonzImageP &ti, TRegion *region,
UINT i = 0;
for (; i < region->getSubregionCount(); ++i) {
subregion = region->getSubregion(i);
- fastAddPaintRegion(ti, subregion, tmin(maxStyleId, subregion->getStyle()), maxStyleId);
+ fastAddPaintRegion(ti, subregion, std::min(maxStyleId, subregion->getStyle()), maxStyleId);
}
}
}
@@ -433,7 +433,7 @@ TToonzImageP ToonzImageUtils::vectorToToonzImage(
for (k = 0; k < regionCount; ++k)
if (vi->areDifferentGroup(i, false, k, true) == -1) {
TRegion *region = vi->getRegion(k);
- fastAddPaintRegion(ti, region, tmin(maxStyleId, region->getStyle()), maxStyleId);
+ fastAddPaintRegion(ti, region, std::min(maxStyleId, region->getStyle()), maxStyleId);
}
//Find the first stroke which does not belong to the group
@@ -460,7 +460,7 @@ TToonzImageP ToonzImageUtils::vectorToToonzImage(
}
}
if (visible)
- fastAddInkStroke(ti, stroke, tmin(maxStyleId, stroke->getStyle()), false, false, clip, true, colors);
+ fastAddInkStroke(ti, stroke, std::min(maxStyleId, stroke->getStyle()), false, false, clip, true, colors);
}
i = k;
}
@@ -737,10 +737,10 @@ void ToonzImageUtils::eraseImage(const TToonzImageP &ti, const TRaster32P &image
int paint, tone;
if (!invert) {
paint = inPix->m > 0 && erasePaint && canErasePaint ? 0 : outPix->getPaint();
- tone = inPix->m > 0 && eraseInk && canEraseInk ? tmax(outPix->getTone(), (int)inPix->m) : outPix->getTone();
+ tone = inPix->m > 0 && eraseInk && canEraseInk ? std::max(outPix->getTone(), (int)inPix->m) : outPix->getTone();
} else {
paint = inPix->m < 255 && erasePaint && canErasePaint ? 0 : outPix->getPaint();
- tone = inPix->m < 255 && eraseInk && canEraseInk ? tmax(outPix->getTone(), 255 - (int)inPix->m) : outPix->getTone();
+ tone = inPix->m < 255 && eraseInk && canEraseInk ? std::max(outPix->getTone(), 255 - (int)inPix->m) : outPix->getTone();
}
*outPix = TPixelCM32(outPix->getInk(), paint, tone);
}
diff --git a/toonz/sources/toonzlib/toutlinevectorizer.cpp b/toonz/sources/toonzlib/toutlinevectorizer.cpp
index b4e4faa69..b42bd5cfe 100644
--- a/toonz/sources/toonzlib/toutlinevectorizer.cpp
+++ b/toonz/sources/toonzlib/toutlinevectorizer.cpp
@@ -890,8 +890,8 @@ bool isNearestInkOrPaintInRegion(bool findInk, const TRasterCM32P &ras, TRegion
for (i = 1; i <= 100; i++) {
int j, t, s, e;
if (p.x - i >= 0) {
- my = tmax(p.y - i, 0);
- My = tmin(p.y + i, ras->getLy() - 1);
+ my = std::max(p.y - i, 0);
+ My = std::min(p.y + i, ras->getLy() - 1);
for (j = my; j <= My; j++) {
TPixelCM32 col = ras->pixels(j)[p.x - i];
int tone = col.getTone();
@@ -904,8 +904,8 @@ bool isNearestInkOrPaintInRegion(bool findInk, const TRasterCM32P &ras, TRegion
}
}
if (p.y + i < ras->getLy()) {
- mx = tmax(p.x - i + 1, 0);
- Mx = tmin(p.x + i, ras->getLx() - 1);
+ mx = std::max(p.x - i + 1, 0);
+ Mx = std::min(p.x + i, ras->getLx() - 1);
for (t = mx; t <= Mx; t++) {
TPixelCM32 col = ras->pixels(p.y + i)[t];
int tone = col.getTone();
@@ -918,8 +918,8 @@ bool isNearestInkOrPaintInRegion(bool findInk, const TRasterCM32P &ras, TRegion
}
}
if (p.x + i < ras->getLx()) {
- my = tmax(p.y - i, 0);
- My = tmin(p.y + i - 1, ras->getLy() - 1);
+ my = std::max(p.y - i, 0);
+ My = std::min(p.y + i - 1, ras->getLy() - 1);
for (s = my; s <= My; s++) {
TPixelCM32 col = ras->pixels(s)[p.x + i];
int tone = col.getTone();
@@ -932,8 +932,8 @@ bool isNearestInkOrPaintInRegion(bool findInk, const TRasterCM32P &ras, TRegion
}
}
if (p.y - i >= 0) {
- mx = tmax(p.x - i + 1, 0);
- Mx = tmin(p.x + i - 1, ras->getLx() - 1);
+ mx = std::max(p.x - i + 1, 0);
+ Mx = std::min(p.x + i - 1, ras->getLx() - 1);
for (e = mx; e <= Mx; e++) {
TPixelCM32 col = ras->pixels(p.y - i)[e];
int tone = col.getTone();
@@ -968,7 +968,7 @@ inline bool isBright(const TPixelGR8 &pix, int threshold)
inline bool isBright(const TPixel32 &pix, int threshold)
{
// Using Value in HSV color model
- return tmax(pix.r, tmax(pix.g, pix.b)) >= threshold * (pix.m / 255.0);
+ return std::max(pix.r, std::max(pix.g, pix.b)) >= threshold * (pix.m / 255.0);
// Using Lightness in HSL color model
//return (max(pix.r,max(pix.g,pix.b)) + min(pix.r,min(pix.g,pix.b))) / 2.0
@@ -1075,7 +1075,7 @@ bool getInternalPoint(const TRasterPT<Pix> &ras, const Selector &sel,
bool adjustPoint(TPointD &p)
{
const TRectD &bbox = m_region.getBBox();
- const double tol = tmax(1e-1 * m_pixelSize, 1e-4);
+ const double tol = std::max(1e-1 * m_pixelSize, 1e-4);
TPointD newP = p;
{
diff --git a/toonz/sources/toonzlib/trasterimageutils.cpp b/toonz/sources/toonzlib/trasterimageutils.cpp
index f3f891140..4d9b82005 100644
--- a/toonz/sources/toonzlib/trasterimageutils.cpp
+++ b/toonz/sources/toonzlib/trasterimageutils.cpp
@@ -174,7 +174,7 @@ void fastAddPaintRegion(const TRasterImageP &ri, TRegion *region,
UINT i = 0;
for (; i < region->getSubregionCount(); ++i) {
subregion = region->getSubregion(i);
- fastAddPaintRegion(ri, subregion, tmin(maxStyleId, subregion->getStyle()), maxStyleId);
+ fastAddPaintRegion(ri, subregion, std::min(maxStyleId, subregion->getStyle()), maxStyleId);
}
}
}
@@ -268,7 +268,7 @@ TRasterImageP TRasterImageUtils::vectorToFullColorImage(
int maxStyleId = palette->getStyleCount() - 1;
for (i = 0; i < (int)vi->getRegionCount(); ++i) {
TRegion *region = vi->getRegion(i);
- fastAddPaintRegion(ri, region, tmin(maxStyleId, region->getStyle()), maxStyleId);
+ fastAddPaintRegion(ri, region, std::min(maxStyleId, region->getStyle()), maxStyleId);
}
set<int> colors;
diff --git a/toonz/sources/toonzlib/tstageobjecttree.cpp b/toonz/sources/toonzlib/tstageobjecttree.cpp
index 26ea2c8a1..c13a11af6 100644
--- a/toonz/sources/toonzlib/tstageobjecttree.cpp
+++ b/toonz/sources/toonzlib/tstageobjecttree.cpp
@@ -649,7 +649,7 @@ void TStageObjectTree::insertSpline(TStageObjectSpline *s)
if (containsSpline(s))
return;
splines[s->getId()] = s;
- m_imp->m_splineCount = tmax(m_imp->m_splineCount, s->getId() + 1);
+ m_imp->m_splineCount = std::max(m_imp->m_splineCount, s->getId() + 1);
s->addRef();
}
diff --git a/toonz/sources/toonzlib/txsheet.cpp b/toonz/sources/toonzlib/txsheet.cpp
index 8fe7fb370..9ba8311d2 100644
--- a/toonz/sources/toonzlib/txsheet.cpp
+++ b/toonz/sources/toonzlib/txsheet.cpp
@@ -1209,7 +1209,7 @@ void TXsheet::updateFrameCount()
for (int i = 0; i < m_imp->m_columnSet.getColumnCount(); ++i) {
TXshColumnP cc = m_imp->m_columnSet.getColumn(i);
if (cc && !cc->isEmpty())
- m_imp->m_frameCount = tmax(m_imp->m_frameCount, cc->getMaxFrame() + 1);
+ m_imp->m_frameCount = std::max(m_imp->m_frameCount, cc->getMaxFrame() + 1);
}
}
@@ -1237,7 +1237,7 @@ void TXsheet::loadData(TIStream &is)
if (TXshZeraryFxColumn *zc = dynamic_cast<TXshZeraryFxColumn *>(column)) {
TFx *fx = zc->getZeraryColumnFx()->getZeraryFx();
int fxTypeCount = m_imp->m_fxDag->getFxTypeCount(fx);
- int maxFxTypeId = tmax(fxTypeCount, fx->getAttributes()->getId());
+ int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
m_imp->m_fxDag->updateFxTypeTable(fx, maxFxTypeId);
m_imp->m_fxDag->updateFxIdTable(fx);
for (int j = 0; j < fx->getParams()->getParamCount(); j++) {
@@ -1397,7 +1397,7 @@ void TXsheet::moveColumn(int srcIndex, int dstIndex)
return;
assert(srcIndex >= 0);
assert(dstIndex >= 0);
- int col = tmax(srcIndex, dstIndex);
+ int col = std::max(srcIndex, dstIndex);
if (col >= m_imp->m_columnSet.getColumnCount()) {
int n = m_imp->m_columnSet.getColumnCount();
touchColumn(col, TXshColumn::eLevelType);
@@ -1718,10 +1718,10 @@ TRectD TXsheet::getBBox(int r) const
const TRectD &colBBox = locals::getBBox(this, r, c);
// Make the union
- bbox.x0 = tmin(bbox.x0, colBBox.x0);
- bbox.y0 = tmin(bbox.y0, colBBox.y0);
- bbox.x1 = tmax(bbox.x1, colBBox.x1);
- bbox.y1 = tmax(bbox.y1, colBBox.y1);
+ bbox.x0 = std::min(bbox.x0, colBBox.x0);
+ bbox.y0 = std::min(bbox.y0, colBBox.y0);
+ bbox.x1 = std::max(bbox.x1, colBBox.x1);
+ bbox.y1 = std::max(bbox.y1, colBBox.y1);
}
return bbox;
diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp
index 67c2e5dca..1a5613567 100644
--- a/toonz/sources/toonzlib/txshsimplelevel.cpp
+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp
@@ -754,7 +754,7 @@ TAffine getAffine(const TDimension &srcSize, const TDimension &dstSize)
{
double scx = 1 * dstSize.lx / (double)srcSize.lx;
double scy = 1 * dstSize.ly / (double)srcSize.ly;
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
double dx = (dstSize.lx - srcSize.lx * sc) * 0.5;
double dy = (dstSize.ly - srcSize.ly * sc) * 0.5;
return TScale(sc) * TTranslation(0.5 * TPointD(srcSize.lx, srcSize.ly) + TPointD(dx, dy));
@@ -789,7 +789,7 @@ TImageP buildIcon(const TImageP &img, const TDimension &size)
rasCM32 = rasCM32->extractT(bbox);
double sx = raster->getLx() / (double)rasCM32->getLx();
double sy = raster->getLy() / (double)rasCM32->getLy();
- double sc = tmin(sx, sy);
+ double sc = std::min(sx, sy);
TAffine aff = TScale(sc).place(
rasCM32->getCenterD(),
raster->getCenterD());
diff --git a/toonz/sources/toonzlib/txshsoundlevel.cpp b/toonz/sources/toonzlib/txshsoundlevel.cpp
index 58178dc56..86070f19a 100644
--- a/toonz/sources/toonzlib/txshsoundlevel.cpp
+++ b/toonz/sources/toonzlib/txshsoundlevel.cpp
@@ -183,7 +183,7 @@ void TXshSoundLevel::computeValues(int frameHeight)
m_soundTrack->getMinMaxPressure(
TINT32(0), (TINT32)sampleCount, TSound::LEFT, minPressure, maxPressure);
- double absMaxPressure = tmax(fabs(minPressure), fabs(maxPressure));
+ double absMaxPressure = std::max(fabs(minPressure), fabs(maxPressure));
if (absMaxPressure <= 0)
return;
diff --git a/toonz/sources/toonzqt/doublefield.cpp b/toonz/sources/toonzqt/doublefield.cpp
index 1b7b2683e..624c205b5 100644
--- a/toonz/sources/toonzqt/doublefield.cpp
+++ b/toonz/sources/toonzqt/doublefield.cpp
@@ -526,5 +526,5 @@ void MeasuredDoubleField::setDecimals(int decimals)
/*--- rollerにもStepを設定 ---*/
if (isRollerEnabled())
- m_roller->setStep(pow(0.1, tmax(decimals - 1, 1)));
+ m_roller->setStep(pow(0.1, std::max(decimals - 1, 1)));
}
diff --git a/toonz/sources/toonzqt/dvdialog.cpp b/toonz/sources/toonzqt/dvdialog.cpp
index 7541ae6d9..6d51498e3 100644
--- a/toonz/sources/toonzqt/dvdialog.cpp
+++ b/toonz/sources/toonzqt/dvdialog.cpp
@@ -249,7 +249,7 @@ Dialog::Dialog(QWidget *parent, bool hasButton, bool hasFixedSize, const QString
if (geo != QString()) {
QStringList values = geo.split(" ");
assert(values.size() == 4);
- setGeometry(values.at(0).toInt(), tmax(30, values.at(1).toInt()), values.at(2).toInt(), values.at(3).toInt());
+ setGeometry(values.at(0).toInt(), std::max(30, values.at(1).toInt()), values.at(2).toInt(), values.at(3).toInt());
}
}
diff --git a/toonz/sources/toonzqt/flipconsole.cpp b/toonz/sources/toonzqt/flipconsole.cpp
index 50b732ae0..42c322317 100644
--- a/toonz/sources/toonzqt/flipconsole.cpp
+++ b/toonz/sources/toonzqt/flipconsole.cpp
@@ -226,7 +226,7 @@ void PlaybackExecutor::run()
}
// Calculate the new emission instant
- emissionInstant = tmax((int)(emissionInstantD += targetFrameTime), 0);
+ emissionInstant = std::max((int)(emissionInstantD += targetFrameTime), 0);
// Sleep until the next emission instant has been reached
while (timer.getTotalTime() < emissionInstant)
@@ -1848,12 +1848,12 @@ void FlipConsole::onPreferenceChanged()
}
int dc = 150;
- QColor lightBevel(tmin(m_blankColor.r + dc, 255),
- tmin(m_blankColor.g + dc, 255),
- tmin(m_blankColor.b + dc, 255));
- QColor darkBevel(tmax(m_blankColor.r - dc, 0),
- tmax(m_blankColor.g - dc, 0),
- tmax(m_blankColor.b - dc, 0));
+ QColor lightBevel(std::min(m_blankColor.r + dc, 255),
+ std::min(m_blankColor.g + dc, 255),
+ std::min(m_blankColor.b + dc, 255));
+ QColor darkBevel(std::max(m_blankColor.r - dc, 0),
+ std::max(m_blankColor.g - dc, 0),
+ std::max(m_blankColor.b - dc, 0));
m_enableBlankFrameButton->setStyleSheet(
QString("#enableBlankFrameButton{ \
diff --git a/toonz/sources/toonzqt/functionpanel.cpp b/toonz/sources/toonzqt/functionpanel.cpp
index 5c702b496..2f04f6bb8 100644
--- a/toonz/sources/toonzqt/functionpanel.cpp
+++ b/toonz/sources/toonzqt/functionpanel.cpp
@@ -443,15 +443,15 @@ QPainterPath FunctionPanel::getSegmentPainterPath(TDoubleParam *curve, int segme
int step = 1;
if (kCount > 0) {
if (segmentIndex < 0)
- frame1 = tmin(frame1, curve->keyframeIndexToFrame(0)); // before first keyframe
+ frame1 = std::min(frame1, curve->keyframeIndexToFrame(0)); // before first keyframe
else if (segmentIndex >= kCount - 1)
- frame0 = tmax(frame0, curve->keyframeIndexToFrame(kCount - 1)); // after last keyframe
+ frame0 = std::max(frame0, curve->keyframeIndexToFrame(kCount - 1)); // after last keyframe
else {
// between keyframes
TDoubleKeyframe kf = curve->getKeyframe(segmentIndex);
- frame0 = tmax(frame0, kf.m_frame);
+ frame0 = std::max(frame0, kf.m_frame);
double f = curve->keyframeIndexToFrame(segmentIndex + 1);
- frame1 = tmin(frame1, f);
+ frame1 = std::min(frame1, f);
step = kf.m_step;
}
}
@@ -465,7 +465,7 @@ QPainterPath FunctionPanel::getSegmentPainterPath(TDoubleParam *curve, int segme
} else //FRAME_BASED
{
frame = (double)tfloor(frame0);
- df = tmax(df, 1.0);
+ df = std::max(df, 1.0);
}
QPainterPath path;
@@ -592,7 +592,7 @@ void FunctionPanel::drawValueGrid(QPainter &painter)
if (isLabel) {
painter.setPen(m_textColor);
QString labelText = QString::number(v);
- painter.drawText(tmax(0, x - 5 - fm.width(labelText)), y + fm.height() / 2, labelText);
+ painter.drawText(std::max(0, x - 5 - fm.width(labelText)), y + fm.height() / 2, labelText);
}
}
if (false && ruler.getTickCount() > 10) {
diff --git a/toonz/sources/toonzqt/functionselection.cpp b/toonz/sources/toonzqt/functionselection.cpp
index 883a76b3f..46d4387eb 100644
--- a/toonz/sources/toonzqt/functionselection.cpp
+++ b/toonz/sources/toonzqt/functionselection.cpp
@@ -83,7 +83,7 @@ public:
: m_data(dynamic_cast<FunctionKeyframesData *>(data->clone())), m_frame(frame)
{
assert((int)params.size() <= data->getColumnCount());
- int columnCount = tmin((int)(params.size()), data->getColumnCount());
+ int columnCount = std::min((int)(params.size()), data->getColumnCount());
m_columns.resize(columnCount);
for (int col = 0; col < columnCount; col++) {
TDoubleParam *param = params[col];
diff --git a/toonz/sources/toonzqt/fxschematicnode.cpp b/toonz/sources/toonzqt/fxschematicnode.cpp
index c87b09490..5e683525b 100644
--- a/toonz/sources/toonzqt/fxschematicnode.cpp
+++ b/toonz/sources/toonzqt/fxschematicnode.cpp
@@ -1612,8 +1612,8 @@ void FxSchematicPort::handleSnappedLinksOnDynamicPortFx(const std::vector<TFxPor
//hide existing links
QMap<int, SchematicPort *> linkedPorts;
- int minIndex = tmin(targetIndex, startIndex);
- int maxIndex = tmax(targetIndex, startIndex);
+ int minIndex = std::min(targetIndex, startIndex);
+ int maxIndex = std::max(targetIndex, startIndex);
for (i = minIndex; i <= maxIndex; i++) {
TFxPort *currentPort = groupedPorts[i];
int portId = getInputPortIndex(currentPort, currentPort->getOwnerFx());
diff --git a/toonz/sources/toonzqt/fxschematicscene.cpp b/toonz/sources/toonzqt/fxschematicscene.cpp
index 0b15ee87f..863eb858a 100644
--- a/toonz/sources/toonzqt/fxschematicscene.cpp
+++ b/toonz/sources/toonzqt/fxschematicscene.cpp
@@ -679,7 +679,7 @@ void FxSchematicScene::placeNode(FxSchematicNode *node)
TFx *terminalFx = terminalFxs->getFx(i);
if (terminalFx->getAttributes()->getDagNodePos() == TConst::nowhere)
continue;
- maxX = tmax(maxX, terminalFx->getAttributes()->getDagNodePos().x);
+ maxX = std::max(maxX, terminalFx->getAttributes()->getDagNodePos().x);
}
TPointD oldPos = node->getFx()->getAttributes()->getDagNodePos();
QPointF pos;
@@ -1165,7 +1165,7 @@ void FxSchematicScene::reorderScene()
x = sceneCenter.x();
placeNodeAndParents(fx, x, maxX, minY);
y -= step;
- minY = tmin(y, minY);
+ minY = std::min(y, minY);
}
//remove retrolink
@@ -1222,7 +1222,7 @@ void FxSchematicScene::removeRetroLinks(TFx *fx, double &maxX)
if (fxPos.x <= inFxPos.x) {
while (fxPos.x <= inFxPos.x)
fxPos.x += 150;
- maxX = tmax(fxPos.x + 150, maxX);
+ maxX = std::max(fxPos.x + 150, maxX);
fx->getAttributes()->setDagNodePos(fxPos);
for (int j = 0; j < fx->getOutputConnectionCount(); j++) {
TFx *outFx = fx->getOutputConnection(j)->getOwnerFx();
@@ -1258,7 +1258,7 @@ void FxSchematicScene::placeNodeAndParents(TFx *fx, double x, double &maxX, doub
if (fx->getOutputConnectionCount() == 0)
minY -= step;
x += 120;
- maxX = tmax(maxX, x);
+ maxX = std::max(maxX, x);
int i;
for (i = 0; i < fx->getOutputConnectionCount(); i++) {
TFx *outputFx = fx->getOutputConnection(i)->getOwnerFx();
@@ -1269,7 +1269,7 @@ void FxSchematicScene::placeNodeAndParents(TFx *fx, double x, double &maxX, doub
if (!m_placedFxs.contains(outputFx) || outputFx->getAttributes()->getDagNodePos().x < x) {
placeNodeAndParents(outputFx, x, maxX, minY);
y -= step;
- minY = tmin(y, minY);
+ minY = std::min(y, minY);
}
}
}
diff --git a/toonz/sources/toonzqt/icongenerator.cpp b/toonz/sources/toonzqt/icongenerator.cpp
index 219d02c18..d57458653 100644
--- a/toonz/sources/toonzqt/icongenerator.cpp
+++ b/toonz/sources/toonzqt/icongenerator.cpp
@@ -230,7 +230,7 @@ TRaster32P convertToIcon(
const int margin = 10;
double scx = (iconSize.lx - margin) / imageBox.getLx();
double scy = (iconSize.ly - margin) / imageBox.getLy();
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
// aggiungo la traslazione: il punto centrale dell'immagine va nel punto
// centrale della pixmap
TPointD iconCenter(iconSize.lx * 0.5, iconSize.ly * 0.5);
@@ -290,7 +290,7 @@ TRaster32P convertToIcon(
int lx = rasCM32->getSize().lx;
int ly = rasCM32->getSize().ly;
int iconLx = iconSize.lx, iconLy = iconSize.ly;
- if (tmax(double(lx) / iconSize.lx, double(ly) / iconSize.ly) == double(ly) / iconSize.ly)
+ if (std::max(double(lx) / iconSize.lx, double(ly) / iconSize.ly) == double(ly) / iconSize.ly)
iconLx = tround((double(lx) * iconSize.ly) / ly);
else
iconLy = tround((double(ly) * iconSize.lx) / lx);
@@ -395,7 +395,7 @@ TRaster32P convertToIcon(
const int margin = 10;
double scx = (iconSize.lx - margin) / imageBox.getLx();
double scy = (iconSize.ly - margin) / imageBox.getLy();
- double sc = tmin(scx, scy);
+ double sc = std::min(scx, scy);
// aggiungo la traslazione: il punto centrale dell'immagine va nel punto
// centrale della pixmap
@@ -631,7 +631,7 @@ TRaster32P SplineIconRenderer::generateRaster(const TDimension &iconSize) const
scaleX = (double)iconSize.lx / sbbox.getLx();
if (sbbox.getLy() > 0.0)
scaleY = (double)iconSize.ly / sbbox.getLy();
- double scale = 0.8 * tmin(scaleX, scaleY);
+ double scale = 0.8 * std::min(scaleX, scaleY);
TPointD centerStroke = 0.5 * (sbbox.getP00() + sbbox.getP11());
TPointD centerPixmap(iconSize.lx * 0.5, iconSize.ly * 0.5);
glPushMatrix();
@@ -1122,7 +1122,7 @@ TRaster32P IconGenerator::generateRasterFileIcon(
double sx = double(iconSize.lx) / ras32->getLx();
double sy = double(iconSize.ly) / ras32->getLy();
- double sc = tmin(sx, sy); // show all the image, possibly adding bands
+ double sc = std::min(sx, sy); // show all the image, possibly adding bands
TAffine aff = TScale(sc).place(ras32->getCenterD(), icon->getCenterD());
@@ -1385,7 +1385,7 @@ TOfflineGL *IconGenerator::getOfflineGLContext()
{
//One context per rendering thread
if (!m_contexts.hasLocalData()) {
- TDimension contextSize(tmax(FilmstripIconSize.lx, IconSize.lx), tmax(FilmstripIconSize.ly, IconSize.ly));
+ TDimension contextSize(std::max(FilmstripIconSize.lx, IconSize.lx), std::max(FilmstripIconSize.ly, IconSize.ly));
m_contexts.setLocalData(new TOfflineGL(contextSize));
}
return m_contexts.localData();
diff --git a/toonz/sources/toonzqt/marksbar.cpp b/toonz/sources/toonzqt/marksbar.cpp
index 80fed9c2a..7188f2388 100644
--- a/toonz/sources/toonzqt/marksbar.cpp
+++ b/toonz/sources/toonzqt/marksbar.cpp
@@ -25,7 +25,7 @@ void crop(QVector<int> &values, int min, int max)
void rollDown(QVector<int> &values, int max, int sortDist)
{
assert(!values.empty());
- values.back() = tmin(max, values.back());
+ values.back() = std::min(max, values.back());
int val;
@@ -43,7 +43,7 @@ void rollDown(QVector<int> &values, int max, int sortDist)
void rollUp(QVector<int> &values, int min, int sortDist)
{
assert(!values.empty());
- values.front() = tmax(min, values.front());
+ values.front() = std::max(min, values.front());
int val;
diff --git a/toonz/sources/toonzqt/pickrgbutils.cpp b/toonz/sources/toonzqt/pickrgbutils.cpp
index e19ca1a98..d8b95dac7 100644
--- a/toonz/sources/toonzqt/pickrgbutils.cpp
+++ b/toonz/sources/toonzqt/pickrgbutils.cpp
@@ -72,10 +72,10 @@ QRgb pickScreenRGB(const QRect &rect)
const QRect &screen0Geom = QApplication::desktop()->screenGeometry(0);
- int left = tmin(rect.left(), screen0Geom.right());
- int top = tmin(rect.top(), screen0Geom.bottom());
- int right = tmax(rect.right(), screen0Geom.left());
- int bottom = tmax(rect.bottom(), screen0Geom.right());
+ int left = std::min(rect.left(), screen0Geom.right());
+ int top = std::min(rect.top(), screen0Geom.bottom());
+ int right = std::max(rect.right(), screen0Geom.left());
+ int bottom = std::max(rect.bottom(), screen0Geom.right());
QRect theRect(QPoint(left, top), QPoint(right, bottom));
diff --git a/toonz/sources/toonzqt/spreadsheetviewer.cpp b/toonz/sources/toonzqt/spreadsheetviewer.cpp
index d165f641a..7ccc4a1fb 100644
--- a/toonz/sources/toonzqt/spreadsheetviewer.cpp
+++ b/toonz/sources/toonzqt/spreadsheetviewer.cpp
@@ -615,7 +615,7 @@ void SpreadsheetViewer::setAutoPanSpeed(const QPoint &speed)
int getAutoPanSpeed(int pixels)
{
int f = 40;
- return tmin(100, (f - 1 + pixels * f) / 100);
+ return std::min(100, (f - 1 + pixels * f) / 100);
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonzqt/stageobjectsdata.cpp b/toonz/sources/toonzqt/stageobjectsdata.cpp
index 2bdceb188..f8eee49fb 100644
--- a/toonz/sources/toonzqt/stageobjectsdata.cpp
+++ b/toonz/sources/toonzqt/stageobjectsdata.cpp
@@ -1044,7 +1044,7 @@ std::vector<TStageObjectId> StageObjectsData::restoreObjects(std::set<int> &colu
// Err.... don't remember. Inquire further? :|
int fxTypeCount = xsh->getFxDag()->getFxTypeCount(fx);
- int maxFxTypeId = tmax(fxTypeCount, fx->getAttributes()->getId());
+ int maxFxTypeId = std::max(fxTypeCount, fx->getAttributes()->getId());
xsh->getFxDag()->updateFxTypeTable(fx, maxFxTypeId);
xsh->getFxDag()->updateFxIdTable(fx);
}
@@ -1081,7 +1081,7 @@ std::vector<TStageObjectId> StageObjectsData::restoreObjects(std::set<int> &colu
if (!doClone) {
int fxTypeCount = xsh->getFxDag()->getFxTypeCount(linkedFx);
- int maxFxTypeId = tmax(fxTypeCount, linkedFx->getAttributes()->getId());
+ int maxFxTypeId = std::max(fxTypeCount, linkedFx->getAttributes()->getId());
xsh->getFxDag()->updateFxTypeTable(linkedFx, maxFxTypeId);
xsh->getFxDag()->updateFxIdTable(linkedFx);
}
diff --git a/toonz/sources/toonzqt/stageschematicscene.cpp b/toonz/sources/toonzqt/stageschematicscene.cpp
index a217b490e..908d3cc15 100644
--- a/toonz/sources/toonzqt/stageschematicscene.cpp
+++ b/toonz/sources/toonzqt/stageschematicscene.cpp
@@ -698,8 +698,8 @@ void StageSchematicScene::placeNodes()
yPos = maxYPos + (pegbar->getId().isCamera() ? 100 : step);
pegbar->setDagNodePos(TPointD(xPos, yPos));
placeChildren(roots[i], xPos, yPos);
- maxXPos = tmax(xPos, maxXPos);
- maxYPos = tmax(yPos, maxYPos);
+ maxXPos = std::max(xPos, maxXPos);
+ maxYPos = std::max(yPos, maxYPos);
}
//places all spline nodes.
@@ -783,7 +783,7 @@ void StageSchematicScene::placeChildren(TreeStageNode *treeNode, double &xPos, d
firstChild = false;
childPegbar->setDagNodePos(TPointD(xChildPos, yPos));
placeChildren(childNode, xChildPos, yPos, startFromCamera);
- xPos = tmax(xPos, xChildPos);
+ xPos = std::max(xPos, xChildPos);
}
}
diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp
index 21a0063dd..78eb93326 100644
--- a/toonz/sources/toonzqt/styleeditor.cpp
+++ b/toonz/sources/toonzqt/styleeditor.cpp
@@ -149,7 +149,7 @@ ColorModel::ColorModel()
void ColorModel::rgb2hsv()
{
QColor converter(m_channels[0], m_channels[1], m_channels[2]);
- m_channels[4] = tmax(converter.hue(), 0); // hue() ritorna -1 per colori acromatici
+ m_channels[4] = std::max(converter.hue(), 0); // hue() ritorna -1 per colori acromatici
m_channels[5] = converter.saturation() * 100 / 255;
m_channels[6] = converter.value() * 100 / 255;
}
@@ -177,7 +177,7 @@ void ColorModel::setTPixel(const TPixel32 &pix)
m_channels[1] = color.green();
m_channels[2] = color.blue();
m_channels[3] = color.alpha();
- m_channels[4] = tmax(color.hue(), 0); // hue() ritorna -1 per colori acromatici
+ m_channels[4] = std::max(color.hue(), 0); // hue() ritorna -1 per colori acromatici
m_channels[5] = color.saturation() * 100 / 255;
m_channels[6] = color.value() * 100 / 255;
}
@@ -883,7 +883,7 @@ void HexagonalColorWheel::clickLeftWheel(const QPoint &pos)
if (h > 359)
h = 359;
//clamping
- int s = (int)(tmin(p.length() / d, 1.0) * 100.0f);
+ int s = (int)(std::min(p.length() / d, 1.0) * 100.0f);
m_color.setValues(eValue, h, s);
@@ -900,10 +900,10 @@ void HexagonalColorWheel::clickRightTriangle(const QPoint &pos)
s = 0;
v = 0;
} else {
- float v_ratio = tmin((float)(p.ry() / (m_triHeight * 2.0f)), 1.0f);
+ float v_ratio = std::min((float)(p.ry() / (m_triHeight * 2.0f)), 1.0f);
float s_f = p.rx() / (m_triEdgeLen * v_ratio);
v = (int)(v_ratio * 100.0f);
- s = (int)(tmin(tmax(s_f, 0.0f), 1.0f) * 100.0f);
+ s = (int)(std::min(std::max(s_f, 0.0f), 1.0f) * 100.0f);
}
m_color.setValues(eHue, s, v);
emit colorChanged(m_color, true);
diff --git a/toonz/sources/toonzqt/styleselection.cpp b/toonz/sources/toonzqt/styleselection.cpp
index ed0fe6c67..b7d78dffc 100644
--- a/toonz/sources/toonzqt/styleselection.cpp
+++ b/toonz/sources/toonzqt/styleselection.cpp
@@ -1782,7 +1782,7 @@ public:
{
std::vector<TColorStyle *> styles;
getStyles(styles, m_selection);
- int n = tmin(styles.size(), colors.size());
+ int n = std::min(styles.size(), colors.size());
for (int i = 0; i < n; i++) {
QString gname = QString::fromStdWString(styles[i]->getGlobalName());
if (!gname.isEmpty() && gname[0] != L'-')
diff --git a/toonz/sources/toonzqt/swatchviewer.cpp b/toonz/sources/toonzqt/swatchviewer.cpp
index e47eace6c..765eb06d4 100644
--- a/toonz/sources/toonzqt/swatchviewer.cpp
+++ b/toonz/sources/toonzqt/swatchviewer.cpp
@@ -367,7 +367,7 @@ void SwatchViewer::updateSize(const QSize &size)
{
int h = size.height();
double ratio = m_cameraRect.getLy() > 0 ? m_cameraRect.getLx() / (double)m_cameraRect.getLy() : 1.0;
- int w = tmin((int)(h * ratio), parentWidget()->width());
+ int w = std::min((int)(h * ratio), parentWidget()->width());
setFixedWidth(w);
if (w > 2 && h > 2)
m_raster = TRaster32P(TDimension(w, h));