Skip to content

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

C

using std::swap instead of tswap (#2195)

otakutoed7dcd58739d
diff --git a/toonz/sources/colorfx/strokestyles.cpp b/toonz/sources/colorfx/strokestyles.cpp
index 29d1e9e1a..8c47fa7d5 100644
--- a/toonz/sources/colorfx/strokestyles.cpp
+++ b/toonz/sources/colorfx/strokestyles.cpp
@@ -2105,7 +2105,7 @@ void TBraidStrokeStyle::drawStroke(const TColorFunction *cf,
swap += step;
if (swap > (period / 3.0)) {
swapcount++;
- tswap(braid[0], braid[1 + (swapcount & 1)]);
+ std::swap(braid[0], braid[1 + (swapcount & 1)]);
swap -= period / 3.0;
}
}
@@ -2188,7 +2188,7 @@ void TBraidStrokeStyle::drawStroke(TFlash &flash, const TStroke *stroke) const {
swap += step;
if (swap > (period / 3.0)) {
swapcount++;
- tswap(braid[0], braid[1 + (swapcount & 1)]);
+ std::swap(braid[0], braid[1 + (swapcount & 1)]);
swap -= period / 3.0;
}
}
diff --git a/toonz/sources/common/tfx/tfx.cpp b/toonz/sources/common/tfx/tfx.cpp
index 125a69e99..b07996bdd 100644
--- a/toonz/sources/common/tfx/tfx.cpp
+++ b/toonz/sources/common/tfx/tfx.cpp
@@ -365,8 +365,8 @@ void TFx::linkParams(TFx *fx) {
assert(m_imp->checkLinks());
assert(fx->m_imp->checkLinks());
- tswap(m_imp->m_next, fx->m_imp->m_next);
- tswap(m_imp->m_next->m_prev, fx->m_imp->m_next->m_prev);
+ std::swap(m_imp->m_next, fx->m_imp->m_next);
+ std::swap(m_imp->m_next->m_prev, fx->m_imp->m_next->m_prev);
assert(m_imp->checkLinks());
assert(fx->m_imp->checkLinks());
diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp
index 646f6641e..37c9e9f5f 100644
--- a/toonz/sources/common/tparam/tdoubleparam.cpp
+++ b/toonz/sources/common/tparam/tdoubleparam.cpp
@@ -251,7 +251,7 @@ inline double getExponentialValue(const TActualDoubleKeyframe &k0,
// if bValue<aValue then v = bValue * exp((1-t) * log(aValue/bValue))
if (bValue < aValue) {
t = 1 - t;
- tswap(aValue, bValue);
+ std::swap(aValue, bValue);
}
return aValue * exp(t * log(bValue / aValue));
}
diff --git a/toonz/sources/common/trop/brush.cpp b/toonz/sources/common/trop/brush.cpp
index f9b561c07..28f1196c1 100644
--- a/toonz/sources/common/trop/brush.cpp
+++ b/toonz/sources/common/trop/brush.cpp
@@ -48,7 +48,7 @@ void TRop::brush(TRaster32P ras, const TPoint &aa, const TPoint &bb, int radius,
const TPixel32 &col) {
TPoint a = aa;
TPoint b = bb;
- if (a.y > b.y) tswap(a, b); // a e' piu' in basso di b
+ if (a.y > b.y) std::swap(a, b); // a e' piu' in basso di b
int lx = ras->getLx();
int ly = ras->getLy();
diff --git a/toonz/sources/common/trop/tautoclose.cpp b/toonz/sources/common/trop/tautoclose.cpp
index f14b5382b..776883969 100644
--- a/toonz/sources/common/trop/tautoclose.cpp
+++ b/toonz/sources/common/trop/tautoclose.cpp
@@ -216,8 +216,8 @@ return;
int y2 = s.second.y;
if (x1 > x2) {
- tswap(x1, x2);
- tswap(y1, y2);
+ std::swap(x1, x2);
+ std::swap(y1, y2);
}
buf += y1 * wrap + x1;
diff --git a/toonz/sources/common/trop/traylit.cpp b/toonz/sources/common/trop/traylit.cpp
index ccd3a88d9..7785ed190 100644
--- a/toonz/sources/common/trop/traylit.cpp
+++ b/toonz/sources/common/trop/traylit.cpp
@@ -329,11 +329,11 @@ void computeOctant(const TRasterPT<T> &src, const TRasterPT<T> &dst, int octant,
dyIn = 1, dyOut = 1, y0 = tfloor(pOut.x), y1 = lxOut;
if (octant == 3 || octant == 6)
dyIn = -1, dyOut = -1, y0 = lxOut - tfloor(pOut.x) - 1, y1 = lxOut,
- tswap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0,
+ std::swap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0,
srcRect.x1 = lxOut - srcRect.x1;
if (octant == 4 || octant == 5)
dxIn = -1, dxOut = -1, x0 = lxOut - tfloor(pOut.x) - 1, x1 = lxOut,
- tswap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0,
+ std::swap(srcRect.x0, srcRect.x1), srcRect.x0 = lxOut - srcRect.x0,
srcRect.x1 = lxOut - srcRect.x1;
// Horizontal octant pairs
@@ -343,18 +343,18 @@ void computeOctant(const TRasterPT<T> &src, const TRasterPT<T> &dst, int octant,
dyIn = srcWrap, dyOut = dstWrap, y0 = tfloor(pOut.y), y1 = lyOut;
if (octant == 5 || octant == 8)
dyIn = -srcWrap, dyOut = -dstWrap, y0 = lyOut - tfloor(pOut.y) - 1,
- y1 = lyOut, tswap(srcRect.y0, srcRect.y1), srcRect.y0 = lyOut - srcRect.y0,
+ y1 = lyOut, std::swap(srcRect.y0, srcRect.y1), srcRect.y0 = lyOut - srcRect.y0,
srcRect.y1 = lyOut - srcRect.y1;
if (octant == 6 || octant == 7)
dxIn = -srcWrap, dxOut = -dstWrap, x0 = lyOut - tfloor(pOut.y) - 1,
- x1 = lyOut, tswap(srcRect.y0, srcRect.y1), srcRect.y0 = lyOut - srcRect.y0,
+ x1 = lyOut, std::swap(srcRect.y0, srcRect.y1), srcRect.y0 = lyOut - srcRect.y0,
srcRect.y1 = lyOut - srcRect.y1;
/*-- 縦向きのピザ領域を計算する場合は、90度回転してから --*/
// Swap x and y axis where necessary
if (octant == 2 || octant == 3 || octant == 6 || octant == 7) {
- tswap(lxIn, lyIn), tswap(lxOut, lyOut);
- tswap(srcRect.x0, srcRect.y0), tswap(srcRect.x1, srcRect.y1);
+ std::swap(lxIn, lyIn), std::swap(lxOut, lyOut);
+ std::swap(srcRect.x0, srcRect.y0), std::swap(srcRect.x1, srcRect.y1);
}
int octLx = (x1 - x0), octLy = (y1 - y0);
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index 76eac869c..b1fc6f3d5 100644
--- a/toonz/sources/common/trop/tresample.cpp
+++ b/toonz/sources/common/trop/tresample.cpp
@@ -3022,7 +3022,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
else
color_blob[color_blobs++] = new_color_blob;
for (; j > 0 && color_blob[j].tot > color_blob[j - 1].tot; j--)
- tswap(color_blob[j], color_blob[j - 1]);
+ std::swap(color_blob[j], color_blob[j - 1]);
new_pencil_blob.val = tcm[i] & pencil_mask;
new_pencil_blob.tot = (tone_mask - tone) * w[i];
for (j = 0; j < pencil_blobs; j++)
@@ -3032,7 +3032,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
else
pencil_blob[pencil_blobs++] = new_pencil_blob;
for (; j > 0 && pencil_blob[j].tot > pencil_blob[j - 1].tot; j--)
- tswap(pencil_blob[j], pencil_blob[j - 1]);
+ std::swap(pencil_blob[j], pencil_blob[j - 1]);
}
tone = troundp(tone_tot);
// if (some_pencil && (TUINT32)tone == tone_mask)
@@ -3100,7 +3100,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
color_blob[color_blobs++] = new_color_blob;
// Sort the stored colors for decreasing weighted total tone
for (; j > 0 && color_blob[j].tot > color_blob[j - 1].tot; j--)
- tswap(color_blob[j], color_blob[j - 1]);
+ std::swap(color_blob[j], color_blob[j - 1]);
// Deal the same way with ink colors.
new_pencil_blob.val = tcm[i] & pencil_mask;
@@ -3112,7 +3112,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
else
pencil_blob[pencil_blobs++] = new_pencil_blob;
for (; j > 0 && pencil_blob[j].tot > pencil_blob[j - 1].tot; j--)
- tswap(pencil_blob[j], pencil_blob[j - 1]);
+ std::swap(pencil_blob[j], pencil_blob[j - 1]);
}
tone = tround(tone_tot);
@@ -3173,7 +3173,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
else
color_blob[color_blobs++] = new_color_blob;
for (; j > 0 && color_blob[j].tot > color_blob[j - 1].tot; j--)
- tswap(color_blob[j], color_blob[j - 1]);
+ std::swap(color_blob[j], color_blob[j - 1]);
new_pencil_blob.val = tcm[i] & pencil_mask;
new_pencil_blob.tot = (tone_mask - tone) * w[i];
for (j = 0; j < pencil_blobs; j++)
@@ -3183,7 +3183,7 @@ void do_resample(TRasterCM32P rout, const TRasterCM32P &rin,
else
pencil_blob[pencil_blobs++] = new_pencil_blob;
for (; j > 0 && pencil_blob[j].tot > pencil_blob[j - 1].tot; j--)
- tswap(pencil_blob[j], pencil_blob[j - 1]);
+ std::swap(pencil_blob[j], pencil_blob[j - 1]);
}
tone = troundp(tone_tot);
// if (some_pencil && (TUINT32)tone == tone_mask)
diff --git a/toonz/sources/common/trop/trop.cpp b/toonz/sources/common/trop/trop.cpp
index 9f51fad46..8eb43ec1f 100644
--- a/toonz/sources/common/trop/trop.cpp
+++ b/toonz/sources/common/trop/trop.cpp
@@ -57,7 +57,7 @@ void TRop::swapRBChannels(const TRaster32P &r) {
TPixel32 *pix = r->pixels(y);
TPixel32 *endPix = pix + lx;
while (pix < endPix) {
- tswap(pix->r, pix->b);
+ std::swap(pix->r, pix->b);
++pix;
}
}
diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp
index 8c828b1db..e28787158 100644
--- a/toonz/sources/common/tvectorimage/tregion.cpp
+++ b/toonz/sources/common/tvectorimage/tregion.cpp
@@ -400,7 +400,7 @@ void findIntersections(double y, const TQuadratic &q, double t0, double t1,
if ((rev && intersectiona < intersectionb) ||
(!rev && intersectiona > intersectionb))
- tswap(intersectiona, intersectionb), tswap(ta, tb);
+ std::swap(intersectiona, intersectionb), std::swap(ta, tb);
if ((t0 < t1 && ta >= t0 && ta <= t1) ||
(t0 >= t1 && ta >= t1 && ta <= t0))
@@ -735,8 +735,8 @@ bool TRegion::Imp::contains(const TPointD &p) const {
if (chunkIndex0 != chunkIndex1) {
/*if (chunkIndex0>chunkIndex1)
{
-tswap(chunkIndex0, chunkIndex1);
-tswap(t0, t1);
+std::swap(chunkIndex0, chunkIndex1);
+std::swap(t0, t1);
}*/
if (chunkIndex0 > chunkIndex1) {
side = findSides(p, *q0, t0, 0, leftAreOdd, side);
diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp
index e495c0240..f2b86a6eb 100644
--- a/toonz/sources/common/tvectorimage/tstroke.cpp
+++ b/toonz/sources/common/tvectorimage/tstroke.cpp
@@ -1071,7 +1071,7 @@ TRectD TStroke::Imp::computeSubBBox(double w0, double w1) const {
const double eps = 0.000000001;
int i;
- if (w0 > w1) tswap(w0, w1);
+ if (w0 > w1) std::swap(w0, w1);
double nw0 = w0 * n;
double nw1 = w1 * n;
@@ -1860,7 +1860,7 @@ const TThickQuadratic *TStroke::getChunk(int index) const {
//-----------------------------------------------------------------------------
TRectD TStroke::getBBox(double w0, double w1) const {
- if (w0 > w1) tswap(w0, w1);
+ if (w0 > w1) std::swap(w0, w1);
if (w0 != 0.0 || w1 != 1.0) return m_imp->computeSubBBox(w0, w1);
diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp
index ac58b7a3a..d6b6fe261 100644
--- a/toonz/sources/common/tvectorimage/tvectorimage.cpp
+++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp
@@ -2329,8 +2329,8 @@ VIStroke *TVectorImage::joinStroke(int index1, int index2, int cpIndex1,
if (index1 > index2) {
finalStyle = getStroke(index1)->getStyle();
- tswap(index1, index2);
- tswap(cpIndex1, cpIndex2);
+ std::swap(index1, index2);
+ std::swap(cpIndex1, cpIndex2);
}
/*
if (index1==index2) //selfLoop!
diff --git a/toonz/sources/common/tvrender/tflash.cpp b/toonz/sources/common/tvrender/tflash.cpp
index fcbe8208e..df77e14c5 100644
--- a/toonz/sources/common/tvrender/tflash.cpp
+++ b/toonz/sources/common/tvrender/tflash.cpp
@@ -147,7 +147,7 @@ public:
: (p0.y < aux.p0.y))
: p0.x < aux.p0.x;
}
- void revert() { tswap(p0, p1); }
+ void revert() { std::swap(p0, p1); }
};
class wChunk {
diff --git a/toonz/sources/image/tif/tiio_tif.cpp b/toonz/sources/image/tif/tiio_tif.cpp
index 0c65df348..7a758d6f9 100644
--- a/toonz/sources/image/tif/tiio_tif.cpp
+++ b/toonz/sources/image/tif/tiio_tif.cpp
@@ -230,8 +230,8 @@ break;*/
bool swapxy = false; // orient == ORIENTATION_RIGHTTOP;
if (swapxy) {
- tswap(w, h);
- tswap(xdpi, ydpi);
+ std::swap(w, h);
+ std::swap(xdpi, ydpi);
}
m_xdpi = xdpi;
@@ -399,8 +399,8 @@ if(stripSize>0)
m_info.m_y0 = 0;
}
if (swapxy) {
- tswap(m_info.m_x0, m_info.m_y0);
- tswap(m_info.m_lx, m_info.m_ly);
+ std::swap(m_info.m_x0, m_info.m_y0);
+ std::swap(m_info.m_lx, m_info.m_ly);
}
m_info.m_x1 = m_info.m_x0 + w;
m_info.m_y1 = m_info.m_y0 + h;
diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h
index 5d2775741..8a4e1f865 100644
--- a/toonz/sources/include/tcommon.h
+++ b/toonz/sources/include/tcommon.h
@@ -28,6 +28,7 @@
#include <fstream>
#include <algorithm>
#include <limits>
+#include <utility>
#if 0 && defined(__GNUC__)
// typedef seems strong on GCC and breaks code with TException..
@@ -88,12 +89,6 @@ typedef unsigned int UINT;
typedef unsigned char BYTE;
#endif
-template <class T>
-inline void tswap(T &a, T &b) {
- T tmp = a;
- a = b;
- b = tmp;
-}
template <class T>
inline T tcrop(T x, T a, T b) {
return std::min(std::max(x, a), b);
diff --git a/toonz/sources/stdfx/changecolorfx.cpp b/toonz/sources/stdfx/changecolorfx.cpp
index 2f776b603..c23048aaa 100644
--- a/toonz/sources/stdfx/changecolorfx.cpp
+++ b/toonz/sources/stdfx/changecolorfx.cpp
@@ -182,7 +182,7 @@ to_v =to_hsv[2]/255.;
double hmax = from_h + range * 180;
hmax = normalize_h(hmax);
if (hmax <= hmin) {
- tswap(hmin, hmax);
+ std::swap(hmin, hmax);
swaprange = true;
}
double smin = from_s - range;
diff --git a/toonz/sources/stdfx/freedistortfx.cpp b/toonz/sources/stdfx/freedistortfx.cpp
index 6f17afa03..8e3dfab61 100644
--- a/toonz/sources/stdfx/freedistortfx.cpp
+++ b/toonz/sources/stdfx/freedistortfx.cpp
@@ -232,8 +232,8 @@ TPointD p11_b = m_p11_b->getValue(frame);
if (m_isCastShadow)
{
- tswap(p00_a, p01_a);
-tswap(p10_a, p11_a);
+ std::swap(p00_a, p01_a);
+std::swap(p10_a, p11_a);
}*/
/*TRectD source;
@@ -306,8 +306,8 @@ void FreeDistortBaseFx::transform(double frame, int port,
if (m_isCastShadow) {
// Shadows are mirrored
- tswap(p00_a, p01_a);
- tswap(p10_a, p11_a);
+ std::swap(p00_a, p01_a);
+ std::swap(p10_a, p11_a);
}
// Build the input affine
@@ -723,8 +723,8 @@ void FreeDistortBaseFx::doCompute(TTile &tile, double frame,
if (m_isCastShadow) {
// Shadows are mirrored
- tswap(p00_a, p01_a);
- tswap(p10_a, p11_a);
+ std::swap(p00_a, p01_a);
+ std::swap(p10_a, p11_a);
}
// Get requested tile's geometry
diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
index f3ac822f5..df3e5de75 100644
--- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
+++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
@@ -242,7 +242,7 @@ throw TException("Scan area too large, select a correct paper size");
TRectD scanArea =
params.isPreview() ? params.getScanArea() : params.getCropBox();
scanArea2pix(params, offsetx, offsety, dimlx, dimly, scanArea);
- tswap(dimlx, dimly);
+ std::swap(dimlx, dimly);
unsigned int bytes;
diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp
index e87c74df1..8e75ba678 100644
--- a/toonz/sources/tnztools/brushtool.cpp
+++ b/toonz/sources/tnztools/brushtool.cpp
@@ -1753,7 +1753,7 @@ bool BrushTool::doFrameRangeStrokes(TFrameId firstFrameId, TStroke *firstStroke,
*last = *lastStroke;
bool swapped = false;
if (firstFrameId > lastFrameId) {
- tswap(firstFrameId, lastFrameId);
+ std::swap(firstFrameId, lastFrameId);
*first = *lastStroke;
*last = *firstStroke;
swapped = true;
diff --git a/toonz/sources/tnztools/controlpointeditortool.cpp b/toonz/sources/tnztools/controlpointeditortool.cpp
index fb58527f1..3b2091717 100644
--- a/toonz/sources/tnztools/controlpointeditortool.cpp
+++ b/toonz/sources/tnztools/controlpointeditortool.cpp
@@ -484,9 +484,9 @@ void ControlPointEditorTool::leftButtonDown(const TPointD &pos,
// ho cliccato lontano da ogni altra curva
m_selectingRect = TRectD(m_pos.x, m_pos.y, m_pos.x + 1, m_pos.y + 1);
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
m_action = RECT_SELECTION;
}
m_selection.selectNone();
@@ -560,7 +560,7 @@ void ControlPointEditorTool::leftButtonDown(const TPointD &pos,
: precPointIndex + 1;
if (precPointIndex > -1 && nextPointIndex > -1) {
if (precPointIndex > nextPointIndex)
- tswap(precPointIndex, nextPointIndex);
+ std::swap(precPointIndex, nextPointIndex);
m_moveSegmentLimitation.first = precPointIndex;
m_moveSegmentLimitation.second = nextPointIndex;
}
@@ -691,9 +691,9 @@ void ControlPointEditorTool::leftButtonDrag(const TPointD &pos,
m_selectingRect.x1 = pos.x;
m_selectingRect.y1 = pos.y;
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
int i;
m_selection.selectNone();
for (i = 0; i < cpCount; i++)
diff --git a/toonz/sources/tnztools/controlpointselection.cpp b/toonz/sources/tnztools/controlpointselection.cpp
index b6a9266ed..cb67c7fac 100644
--- a/toonz/sources/tnztools/controlpointselection.cpp
+++ b/toonz/sources/tnztools/controlpointselection.cpp
@@ -736,7 +736,7 @@ int ControlPointEditorStroke::addControlPoint(const TPointD &pos) {
if (pointIndex > precCp.m_pointIndex + 2) {
// nel caso in cui sono nel secondo chunk scambio i punti
a0 = a4;
- tswap(a1, a3);
+ std::swap(a1, a3);
isInFirstChunk = false;
}
@@ -850,7 +850,7 @@ void ControlPointEditorStroke::moveSegment(int beforeIndex, int nextIndex,
int cpCount = getControlPointCount();
// Verifiche per il caso in cui lo stroke e' selfLoop
if (isSelfLoop() && beforeIndex == 0 && nextIndex == cpCount - 1)
- tswap(beforeIndex, nextIndex);
+ std::swap(beforeIndex, nextIndex);
int beforePointIndex = m_controlPoints[beforeIndex].m_pointIndex;
int nextPointIndex = (isSelfLoop() && nextIndex == 0)
diff --git a/toonz/sources/tnztools/filltool.cpp b/toonz/sources/tnztools/filltool.cpp
index 16facea78..15c85a8f1 100644
--- a/toonz/sources/tnztools/filltool.cpp
+++ b/toonz/sources/tnztools/filltool.cpp
@@ -1024,7 +1024,7 @@ void SequencePainter::processSequence(TXshSimpleLevel *sl, TFrameId firstFid,
bool backward = false;
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
@@ -1421,9 +1421,9 @@ void AreaFillTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) {
m_selecting = false;
if (m_type == RECT) {
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x0, m_selectingRect.x1);
+ std::swap(m_selectingRect.x0, m_selectingRect.x1);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y0, m_selectingRect.y1);
+ std::swap(m_selectingRect.y0, m_selectingRect.y1);
if (m_frameRange) {
if (m_firstFrameSelected) {
diff --git a/toonz/sources/tnztools/fullcolorerasertool.cpp b/toonz/sources/tnztools/fullcolorerasertool.cpp
index 4ff46de2a..458d1fcd1 100644
--- a/toonz/sources/tnztools/fullcolorerasertool.cpp
+++ b/toonz/sources/tnztools/fullcolorerasertool.cpp
@@ -580,15 +580,15 @@ void FullColorEraserTool::leftButtonDrag(const TPointD &pos,
if (m_eraseType.getValue() == RECTERASE) {
assert(m_selecting);
TRectD oldRect = m_selectingRect;
- if (oldRect.x0 > oldRect.x1) tswap(oldRect.x1, oldRect.x0);
- if (oldRect.y0 > oldRect.y1) tswap(oldRect.y1, oldRect.y0);
+ if (oldRect.x0 > oldRect.x1) std::swap(oldRect.x1, oldRect.x0);
+ if (oldRect.y0 > oldRect.y1) std::swap(oldRect.y1, oldRect.y0);
m_selectingRect.x1 = pos.x;
m_selectingRect.y1 = pos.y;
TRectD invalidateRect(m_selectingRect);
if (invalidateRect.x0 > invalidateRect.x1)
- tswap(invalidateRect.x1, invalidateRect.x0);
+ std::swap(invalidateRect.x1, invalidateRect.x0);
if (invalidateRect.y0 > invalidateRect.y1)
- tswap(invalidateRect.y1, invalidateRect.y0);
+ std::swap(invalidateRect.y1, invalidateRect.y0);
invalidateRect += oldRect;
invalidate(invalidateRect.enlarge(2));
}
@@ -647,9 +647,9 @@ void FullColorEraserTool::leftButtonUp(const TPointD &pos,
notifyImageChanged();
} else if (m_eraseType.getValue() == RECTERASE) {
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
if (m_multi.getValue()) {
TTool::Application *app = TTool::getApplication();
@@ -1042,7 +1042,7 @@ void FullColorEraserTool::multiUpdate(const TRectD firstRect,
TFrameId firstFid = m_firstFrameId;
TFrameId lastFid = getCurrentFid();
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
@@ -1114,7 +1114,7 @@ void FullColorEraserTool::multiAreaEraser(TFrameId &firstFid, TFrameId &lastFid,
bool backward = false;
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
diff --git a/toonz/sources/tnztools/irontool.cpp b/toonz/sources/tnztools/irontool.cpp
index f583eae88..fe6572611 100644
--- a/toonz/sources/tnztools/irontool.cpp
+++ b/toonz/sources/tnztools/irontool.cpp
@@ -168,7 +168,7 @@ public:
if (!direction) {
draggedStrokeLen = totalStrokeLen - draggedStrokeLen;
- tswap(v0, v1);
+ std::swap(v0, v1);
}
// se la lunghezza della parte di stroke tra i due punti di inizio e fine
diff --git a/toonz/sources/tnztools/rastererasertool.cpp b/toonz/sources/tnztools/rastererasertool.cpp
index 8190503e8..a2df61e17 100644
--- a/toonz/sources/tnztools/rastererasertool.cpp
+++ b/toonz/sources/tnztools/rastererasertool.cpp
@@ -761,7 +761,7 @@ void EraserTool::multiUpdate(const TXshSimpleLevelP &level, TFrameId firstFid,
TRectD lastRect) {
bool backward = false;
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
@@ -980,15 +980,15 @@ void EraserTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
TPointD rasCenter = ti->getRaster()->getCenterD();
if (m_eraseType.getValue() == RECTERASE) {
TRectD oldRect = m_selectingRect;
- if (oldRect.x0 > oldRect.x1) tswap(oldRect.x1, oldRect.x0);
- if (oldRect.y0 > oldRect.y1) tswap(oldRect.y1, oldRect.y0);
+ if (oldRect.x0 > oldRect.x1) std::swap(oldRect.x1, oldRect.x0);
+ if (oldRect.y0 > oldRect.y1) std::swap(oldRect.y1, oldRect.y0);
m_selectingRect.x1 = pos.x;
m_selectingRect.y1 = pos.y;
invalidateRect = m_selectingRect;
if (invalidateRect.x0 > invalidateRect.x1)
- tswap(invalidateRect.x1, invalidateRect.x0);
+ std::swap(invalidateRect.x1, invalidateRect.x0);
if (invalidateRect.y0 > invalidateRect.y1)
- tswap(invalidateRect.y1, invalidateRect.y0);
+ std::swap(invalidateRect.y1, invalidateRect.y0);
invalidateRect += oldRect;
invalidate(invalidateRect.enlarge(2));
}
@@ -1113,9 +1113,9 @@ void EraserTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) {
if (TToonzImageP ti = image) {
if (m_eraseType.getValue() == RECTERASE) {
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
if (m_multi.getValue()) {
TTool::Application *app = TTool::getApplication();
@@ -1560,7 +1560,7 @@ void EraserTool::multiAreaEraser(const TXshSimpleLevelP &sl, TFrameId &firstFid,
bool backward = false;
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
diff --git a/toonz/sources/tnztools/rastertapetool.cpp b/toonz/sources/tnztools/rastertapetool.cpp
index 51b6e9c68..109e29488 100644
--- a/toonz/sources/tnztools/rastertapetool.cpp
+++ b/toonz/sources/tnztools/rastertapetool.cpp
@@ -301,7 +301,7 @@ public:
TStroke *firstStroke = 0, TStroke *lastStroke = 0) {
bool backward = false;
if (firstFid > lastFid) {
- tswap(firstFid, lastFid);
+ std::swap(firstFid, lastFid);
backward = true;
}
assert(firstFid <= lastFid);
@@ -360,8 +360,8 @@ public:
int r1 = lastFrameId.getNumber();
if (r0 > r1) {
- tswap(r0, r1);
- tswap(firstFrameId, lastFrameId);
+ std::swap(r0, r1);
+ std::swap(firstFrameId, lastFrameId);
}
if ((r1 - r0) < 2) return;
@@ -387,9 +387,9 @@ public:
/*-- Rectの座標の向きを揃える --*/
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
TTool::Application *app = TTool::getApplication();
diff --git a/toonz/sources/tnztools/selectiontool.cpp b/toonz/sources/tnztools/selectiontool.cpp
index 4238c64b1..0d98fe35e 100644
--- a/toonz/sources/tnztools/selectiontool.cpp
+++ b/toonz/sources/tnztools/selectiontool.cpp
@@ -117,7 +117,7 @@ FourPoints DragSelectionTool::FourPoints::orderedPoints() const {
int index = tminPoint(allPoints[minXindex1], points[minXindex2], false);
TPointD newPoint1 = allPoints[minXindex1];
TPointD newPoint2 = points[minXindex2];
- if (index == 1) tswap(newPoint1, newPoint2);
+ if (index == 1) std::swap(newPoint1, newPoint2);
newPoints.setP00(newPoint1);
newPoints.setP01(newPoint2);
@@ -732,7 +732,7 @@ TPointD DragSelectionTool::Scale::getNewCenter(int index, const FourPoints bbox,
m_deformTool->getNextPointIndex(m_deformTool->getNextPointIndex(index));
yIndex = index;
}
- if (index % 2 == 1) tswap(xIndex, yIndex);
+ if (index % 2 == 1) std::swap(xIndex, yIndex);
FourPoints xBbox = bboxScale(xIndex, bbox, m_startCenter);
TPointD xCenter = getScaledPoint(
xIndex, xBbox, scaleValue,
diff --git a/toonz/sources/tnztools/vectorerasertool.cpp b/toonz/sources/tnztools/vectorerasertool.cpp
index ee0471091..2986220a7 100644
--- a/toonz/sources/tnztools/vectorerasertool.cpp
+++ b/toonz/sources/tnztools/vectorerasertool.cpp
@@ -744,8 +744,8 @@ intersect( *oldStroke, pos, m_pointSize, intersections );
//-----------------------------------------------------------------------------
void EraserTool::erase(TVectorImageP vi, TRectD &rect) {
- if (rect.x0 > rect.x1) tswap(rect.x1, rect.x0);
- if (rect.y0 > rect.y1) tswap(rect.y1, rect.y0);
+ if (rect.x0 > rect.x1) std::swap(rect.x1, rect.x0);
+ if (rect.y0 > rect.y1) std::swap(rect.y1, rect.y0);
int i = 0;
int index = TTool::getApplication()->getCurrentLevelStyleIndex();
std::vector<int> eraseStrokes;
@@ -849,9 +849,9 @@ void EraserTool::multiEraseRect(TFrameId firstFrameId, TFrameId lastFrameId,
int r1 = lastFrameId.getNumber();
if (r0 > r1) {
- tswap(r0, r1);
- tswap(firstFrameId, lastFrameId);
- tswap(firstRect, lastRect);
+ std::swap(r0, r1);
+ std::swap(firstFrameId, lastFrameId);
+ std::swap(firstRect, lastRect);
}
if ((r1 - r0) < 1) return;
@@ -941,9 +941,9 @@ void EraserTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) {
stopErase(vi);
else if (m_eraseType.getValue() == RECT_ERASE) {
if (m_selectingRect.x0 > m_selectingRect.x1)
- tswap(m_selectingRect.x1, m_selectingRect.x0);
+ std::swap(m_selectingRect.x1, m_selectingRect.x0);
if (m_selectingRect.y0 > m_selectingRect.y1)
- tswap(m_selectingRect.y1, m_selectingRect.y0);
+ std::swap(m_selectingRect.y1, m_selectingRect.y0);
if (m_multi.getValue()) {
if (m_firstFrameSelected) {
@@ -1278,7 +1278,7 @@ void EraserTool::doMultiErase(TFrameId &firstFrameId, TFrameId &lastFrameId,
bool backward = false;
if (firstFrameId > lastFrameId) {
- tswap(firstFrameId, lastFrameId);
+ std::swap(firstFrameId, lastFrameId);
backward = true;
}
assert(firstFrameId <= lastFrameId);
diff --git a/toonz/sources/tnztools/vectortapetool.cpp b/toonz/sources/tnztools/vectortapetool.cpp
index 3fba465a3..592f022ed 100644
--- a/toonz/sources/tnztools/vectortapetool.cpp
+++ b/toonz/sources/tnztools/vectortapetool.cpp
@@ -668,8 +668,8 @@ public:
? ((m_w2 == 0.0 || m_w2 == 1.0) ? p2p : p2l)
: ((m_w2 == 0.0 || m_w2 == 1.0) ? l2p : l2l);
if (type == l2p) {
- tswap(m_strokeIndex1, m_strokeIndex2);
- tswap(m_w1, m_w2);
+ std::swap(m_strokeIndex1, m_strokeIndex2);
+ std::swap(m_w1, m_w2);
type = p2l;
}
}
diff --git a/toonz/sources/toonz/cellkeyframeselection.cpp b/toonz/sources/toonz/cellkeyframeselection.cpp
index aff00687a..5e2b44bd2 100644
--- a/toonz/sources/toonz/cellkeyframeselection.cpp
+++ b/toonz/sources/toonz/cellkeyframeselection.cpp
@@ -113,8 +113,8 @@ void TCellKeyframeSelection::selectCellsKeyframes(int r0, int c0, int r1,
m_cellSelection->selectCells(r0, c0, r1, c1);
TXsheet *xsh = m_xsheetHandle->getXsheet();
m_xsheetHandle->getXsheet();
- if (r1 < r0) tswap(r0, r1);
- if (c1 < c0) tswap(c0, c1);
+ if (r1 < r0) std::swap(r0, r1);
+ if (c1 < c0) std::swap(c0, c1);
m_keyframeSelection->clear();
int r, c;
for (c = c0; c <= c1; c++)
diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp
index 381e80030..3459ded5c 100644
--- a/toonz/sources/toonz/cellselection.cpp
+++ b/toonz/sources/toonz/cellselection.cpp
@@ -1387,8 +1387,8 @@ bool TCellSelection::isEmpty() const { return m_range.isEmpty(); }
//-----------------------------------------------------------------------------
void TCellSelection::selectCells(int r0, int c0, int r1, int c1) {
- if (r0 > r1) tswap(r0, r1);
- if (c0 > c1) tswap(c0, c1);
+ if (r0 > r1) std::swap(r0, r1);
+ if (c0 > c1) std::swap(c0, c1);
m_range.m_r0 = r0;
m_range.m_c0 = c0;
m_range.m_r1 = r1;
diff --git a/toonz/sources/toonz/filmstripcommand.cpp b/toonz/sources/toonz/filmstripcommand.cpp
index c2914ecfb..1dfc52404 100644
--- a/toonz/sources/toonz/filmstripcommand.cpp
+++ b/toonz/sources/toonz/filmstripcommand.cpp
@@ -1819,7 +1819,7 @@ void performReverse(const TXshSimpleLevelP &sl,
while (i < j && frames.count(fids[i]) == 0) i++;
while (i < j && frames.count(fids[j]) == 0) j--;
if (i >= j) break;
- tswap(fids[i], fids[j]);
+ std::swap(fids[i], fids[j]);
i++;
j--;
}
diff --git a/toonz/sources/toonz/keyframemover.cpp b/toonz/sources/toonz/keyframemover.cpp
index 37b66a0d1..39d1c39d4 100644
--- a/toonz/sources/toonz/keyframemover.cpp
+++ b/toonz/sources/toonz/keyframemover.cpp
@@ -346,8 +346,8 @@ void KeyframeMoverTool::rectSelect(int row, int col) {
selection->selectNone();
TXsheet *xsh = getViewer()->getXsheet();
int r0 = row, c0 = col, r1 = m_firstRow, c1 = m_firstCol;
- if (r0 > r1) tswap(r0, r1);
- if (c0 > c1) tswap(c0, c1);
+ if (r0 > r1) std::swap(r0, r1);
+ if (c0 > c1) std::swap(c0, c1);
for (int c = c0; c <= c1; c++) {
TStageObject *obj = xsh->getStageObject(getViewer()->getObjectId(c));
for (int r = r0; r <= r1; r++) {
diff --git a/toonz/sources/toonz/ruler.cpp b/toonz/sources/toonz/ruler.cpp
index e736c155f..c6d9d509d 100644
--- a/toonz/sources/toonz/ruler.cpp
+++ b/toonz/sources/toonz/ruler.cpp
@@ -272,7 +272,7 @@ void Ruler::mousePressEvent(QMouseEvent *e) {
// aggiorna sprop!!!!
} else {
// muove la guida vecchia
- if (selected < count - 1) tswap(guides[selected], guides.back());
+ if (selected < count - 1) std::swap(guides[selected], guides.back());
// aggiorna sprop!!!!
}
m_moving = true;
diff --git a/toonz/sources/toonz/scanlist.cpp b/toonz/sources/toonz/scanlist.cpp
index fda6ada19..fe14867d3 100644
--- a/toonz/sources/toonz/scanlist.cpp
+++ b/toonz/sources/toonz/scanlist.cpp
@@ -49,8 +49,8 @@ ScanListFrame::ScanListFrame(const ScanListFrame &src)
ScanListFrame &ScanListFrame::operator=(const ScanListFrame &src) {
ScanListFrame tmp(*this);
- tswap(m_xl, tmp.m_xl);
- tswap(m_fid, tmp.m_fid);
+ std::swap(m_xl, tmp.m_xl);
+ std::swap(m_fid, tmp.m_fid);
return *this;
}
diff --git a/toonz/sources/toonz/xsheetdragtool.cpp b/toonz/sources/toonz/xsheetdragtool.cpp
index 690962652..f8e3ce656 100644
--- a/toonz/sources/toonz/xsheetdragtool.cpp
+++ b/toonz/sources/toonz/xsheetdragtool.cpp
@@ -1493,7 +1493,7 @@ public:
TColumnSelection *selection = getViewer()->getColumnSelection();
selection->selectNone();
int i, ia = m_firstColumn, ib = col;
- if (ia > ib) tswap(ia, ib);
+ if (ia > ib) std::swap(ia, ib);
for (i = ia; i <= ib; i++) selection->selectColumn(i, true);
getViewer()->update();
refreshCellsArea();
diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
index c73fd02aa..b9281ec27 100644
--- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
+++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
@@ -264,7 +264,7 @@ public:
}
FarmControllerProxyP &operator=(const FarmControllerProxyP &src) {
FarmControllerProxyP tmp(*this);
- tswap(tmp.m_proxy, m_proxy);
+ std::swap(tmp.m_proxy, m_proxy);
return *this;
}
diff --git a/toonz/sources/toonzlib/autoadjust.cpp b/toonz/sources/toonzlib/autoadjust.cpp
index 0c65622aa..b15d07702 100644
--- a/toonz/sources/toonzlib/autoadjust.cpp
+++ b/toonz/sources/toonzlib/autoadjust.cpp
@@ -74,8 +74,8 @@ void set_autoadjust_window(int x0, int y0, int x1, int y1) {
Window_y0 = y0;
Window_x1 = x1;
Window_y1 = y1;
- if (Window_x0 > Window_x1) tswap(Window_x0, Window_x1);
- if (Window_y0 > Window_y1) tswap(Window_y0, Window_y1);
+ if (Window_x0 > Window_x1) std::swap(Window_x0, Window_x1);
+ if (Window_y0 > Window_y1) std::swap(Window_y0, Window_y1);
}
/*---------------------------------------------------------------------------*/
diff --git a/toonz/sources/toonzlib/autoclose.cpp b/toonz/sources/toonzlib/autoclose.cpp
index 36bfadfb1..48220e70c 100644
--- a/toonz/sources/toonzlib/autoclose.cpp
+++ b/toonz/sources/toonzlib/autoclose.cpp
@@ -217,8 +217,8 @@ return;
int y2 = s.second.y;
if (x1 > x2) {
- tswap(x1, x2);
- tswap(y1, y2);
+ std::swap(x1, x2);
+ std::swap(y1, y2);
}
buf += y1 * wrap + x1;
diff --git a/toonz/sources/toonzlib/fillutil.cpp b/toonz/sources/toonzlib/fillutil.cpp
index 2d5e96871..497ade733 100644
--- a/toonz/sources/toonzlib/fillutil.cpp
+++ b/toonz/sources/toonzlib/fillutil.cpp
@@ -566,8 +566,8 @@ void InkSegmenter::drawSegment(
int y2 = p1.y;
if (x1 > x2) {
- tswap(x1, x2);
- tswap(y1, y2);
+ std::swap(x1, x2);
+ std::swap(y1, y2);
}
TPixelCM32 *buf = m_r->pixels() + y1 * m_wrap + x1;
diff --git a/toonz/sources/toonzlib/sandor_fxs/blend.cpp b/toonz/sources/toonzlib/sandor_fxs/blend.cpp
index e84116c1f..6939ee55b 100644
--- a/toonz/sources/toonzlib/sandor_fxs/blend.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/blend.cpp
@@ -654,8 +654,8 @@ void blend(TToonzImageP ti, TRasterPT<PIXEL> rasOut,
selectionRaster.updateSelection(cmIn, params[i]);
doBlend(cmIn, inkLayer, paintLayer, selectionRaster, blurGroup[i]);
- tswap(inkLayer.first, inkLayer.second);
- tswap(paintLayer.first, paintLayer.second);
+ std::swap(inkLayer.first, inkLayer.second);
+ std::swap(paintLayer.first, paintLayer.second);
}
// Release the unnecessary rasters
diff --git a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
index 55640d1af..25b66c46d 100644
--- a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
+++ b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
@@ -818,7 +818,7 @@ TPointD CenterLineVectorizer::computeCenter(Node *na, Node *nb, double &r) {
TPointD d = pa-pb;
if(fabs(d.x)>fabs(d.y))
{
- if(pa.x>pb.x) tswap(pa,pb);
+ if(pa.x>pb.x) std::swap(pa,pb);
for(int x = pa.x; x<=pb.x; x++)
{
int y = pa.y + (pb.y-pa.y)*(x-pa.x)/(pb.x-pa.x);
@@ -829,7 +829,7 @@ TPointD CenterLineVectorizer::computeCenter(Node *na, Node *nb, double &r) {
}
else
{
- if(pa.y>pb.y) tswap(pa,pb);
+ if(pa.y>pb.y) std::swap(pa,pb);
for(int y = pa.y; y<=pb.y; y++)
{
int x = pa.x + (pb.x-pa.x)*(y-pa.y)/(pb.y-pa.y);
@@ -863,8 +863,8 @@ Node *CenterLineVectorizer::findOtherSide(Node *node) {
TPoint d1(tsign(dir.x), 0), d2(0, tsign(dir.y));
int num = abs(dir.y), den = abs(dir.x);
if (num > den) {
- tswap(d1, d2);
- tswap(num, den);
+ std::swap(d1, d2);
+ std::swap(num, den);
}
TPoint pos = pix->m_pos;
int i;
@@ -1262,7 +1262,7 @@ void CenterLineVectorizer::traceLine(DataPixel *pix) {
dpoints.push_back(point);
}
- tswap(naa, nbb);
+ std::swap(naa, nbb);
}
if (dpoints.size() == 0)
naa->m_visited = nbb->m_visited = false;
diff --git a/toonz/sources/toonzlib/tcleanupper.cpp b/toonz/sources/toonzlib/tcleanupper.cpp
index ab10c53c0..f4cd7ac89 100644
--- a/toonz/sources/toonzlib/tcleanupper.cpp
+++ b/toonz/sources/toonzlib/tcleanupper.cpp
@@ -835,7 +835,7 @@ TRasterImageP TCleanupper::autocenterOnly(const TRasterImageP &image,
aff = aff.place(cxin, cyin, cpout, cqout);
- if (rotate != 0 && rotate != 180) tswap(finalLx, finalLy);
+ if (rotate != 0 && rotate != 180) std::swap(finalLx, finalLy);
TPointD pin = TPointD((rasterLx - 1) / 2.0, (rasterLy - 1) / 2.0);
TPointD pout = TPointD((finalLx - 1) / 2.0, (finalLy - 1) / 2.0);
diff --git a/toonz/sources/toonzlib/tdistort.cpp b/toonz/sources/toonzlib/tdistort.cpp
index 828d3b155..eabe26ae1 100644
--- a/toonz/sources/toonzlib/tdistort.cpp
+++ b/toonz/sources/toonzlib/tdistort.cpp
@@ -82,7 +82,7 @@ TPixelCM32 filterPixel(const TPointD &pos, const TRasterCM32P &rasIn) {
else
paintBlobs[paintBlobsSize++] = currBlob;
for (; j > 0 && paintBlobs[j].tot > paintBlobs[j - 1].tot; j--)
- tswap(paintBlobs[j], paintBlobs[j - 1]);
+ std::swap(paintBlobs[j], paintBlobs[j - 1]);
// Same for ink blobs
currBlob.val = P[i].getInk();
@@ -94,7 +94,7 @@ TPixelCM32 filterPixel(const TPointD &pos, const TRasterCM32P &rasIn) {
else
inkBlobs[inkBlobsSize++] = currBlob;
for (; j > 0 && inkBlobs[j].tot > inkBlobs[j - 1].tot; j--)
- tswap(inkBlobs[j], inkBlobs[j - 1]);
+ std::swap(inkBlobs[j], inkBlobs[j - 1]);
}
tone = troundp(tone_tot);
diff --git a/toonz/sources/toonzlib/toutlinevectorizer.cpp b/toonz/sources/toonzlib/toutlinevectorizer.cpp
index b6aa75f84..876f48850 100644
--- a/toonz/sources/toonzlib/toutlinevectorizer.cpp
+++ b/toonz/sources/toonzlib/toutlinevectorizer.cpp
@@ -423,8 +423,8 @@ Node *OutlineVectorizer::findOtherSide(Node *node) {
TPoint d1(tsign(dir.x), 0), d2(0, tsign(dir.y));
int num = abs(dir.y), den = abs(dir.x);
if (num > den) {
- tswap(d1, d2);
- tswap(num, den);
+ std::swap(d1, d2);
+ std::swap(num, den);
}
TPoint pos = pix->m_pos;
int i;
diff --git a/toonz/sources/toonzlib/tstageobjecttree.cpp b/toonz/sources/toonzlib/tstageobjecttree.cpp
index ae1d0d3ed..e0b02bd7b 100644
--- a/toonz/sources/toonzlib/tstageobjecttree.cpp
+++ b/toonz/sources/toonzlib/tstageobjecttree.cpp
@@ -328,7 +328,7 @@ bool checkId(TStageObjectTree *tree, const TStageObjectId &id) {
void TStageObjectTree::swapColumns(int i, int j) {
if (i == j) return;
- if (i > j) tswap(i, j);
+ if (i > j) std::swap(i, j);
std::map<TStageObjectId, TStageObject *> &pegbars = m_imp->m_pegbarTable;
std::map<TStageObjectId, TStageObject *>::iterator iti, itj;
std::map<TStageObjectId, TStageObject *>::const_iterator end = pegbars.end();
@@ -344,7 +344,7 @@ void TStageObjectTree::swapColumns(int i, int j) {
} else if (iti != end && itj != end) {
assert(iti->second);
assert(itj->second);
- tswap(iti->second, itj->second);
+ std::swap(iti->second, itj->second);
iti->second->setId(iti->first);
itj->second->setId(itj->first);
} else if (iti == end) {
diff --git a/toonz/sources/toonzqt/functionpanel.cpp b/toonz/sources/toonzqt/functionpanel.cpp
index 151d1392c..b6ee8a2b6 100644
--- a/toonz/sources/toonzqt/functionpanel.cpp
+++ b/toonz/sources/toonzqt/functionpanel.cpp
@@ -197,7 +197,7 @@ void Ruler::compute() {
// compute range
double v0 = (m_x0 - m_pan) / m_unit; // left margin (world units)
double v1 = (m_x1 - m_pan) / m_unit; // right margin (world units)
- if (m_unit < 0) tswap(v0, v1);
+ if (m_unit < 0) std::swap(v0, v1);
int i0 =
tfloor((v0 - m_vOrigin) / m_step); // largest tick <=v0 is i0 * m_step
int i1 =
diff --git a/toonz/sources/toonzqt/functiontreeviewer.cpp b/toonz/sources/toonzqt/functiontreeviewer.cpp
index 9fac83fa8..4fca61b77 100644
--- a/toonz/sources/toonzqt/functiontreeviewer.cpp
+++ b/toonz/sources/toonzqt/functiontreeviewer.cpp
@@ -1519,7 +1519,7 @@ void FunctionTreeView::onDrag(TreeModel::Item *item, const QPoint &itemPos,
QModelIndex i0 = channel->createIndex(), i1 = m_clickedItem->createIndex();
if (!i0.isValid() || !i1.isValid() || i0.parent() != i1.parent()) return;
- if (i0.row() > i1.row()) tswap(i0, i1);
+ if (i0.row() > i1.row()) std::swap(i0, i1);
FunctionTreeModel *md = static_cast<FunctionTreeModel *>(model());
diff --git a/toonz/sources/toonzqt/imageutils.cpp b/toonz/sources/toonzqt/imageutils.cpp
index 91cb97b9f..279e9f19d 100644
--- a/toonz/sources/toonzqt/imageutils.cpp
+++ b/toonz/sources/toonzqt/imageutils.cpp
@@ -90,7 +90,7 @@ void getFrameIds(TFrameId from, TFrameId to, const TLevelP &level,
if (to.isEmptyFrame()) to = TFrameId((std::numeric_limits<int>::max)());
- if (from > to) tswap(from, to);
+ if (from > to) std::swap(from, to);
const TLevel::Table &table = *level->getTable();