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

This commit is contained in:
otakuto 2018-08-30 17:18:43 +09:00 committed by shun-iwasawa
parent 2986f2e399
commit ed7dcd5873
48 changed files with 122 additions and 127 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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!

View file

@ -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 {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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++) {

View file

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

View file

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

View file

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

View file

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

View file

@ -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);
}
/*---------------------------------------------------------------------------*/

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 =

View file

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

View file

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