Commit b2ae458f authored by Vincent Pinon's avatar Vincent Pinon
Browse files

fix some more warnings

parent eb7f5026
......@@ -581,7 +581,7 @@ std::pair<QStringList, QStringList> ProviderModel::parseFilesResponse(const QByt
if(keys["downloadUrls"].isObject()) {
if(keys["downloadUrls"].toObject()["isObject"].toBool(false)) {
QJsonObject list = objectGetValue(res, "downloadUrls.key").toObject();
for (const auto key : list.keys()) {
for (const auto &key : list.keys()) {
QJsonObject urlItem = list[key].toObject();
QString format = objectGetString(urlItem, "downloadUrls.format", id, key);
//This ugly check is only for the complicated archive.org api to avoid a long file list for videos caused by thumbs for each frame and metafiles
......
......@@ -10,13 +10,13 @@ enum class ITURec {
};
// CIE 601 luminance factors
constexpr float REC_601_R = .299;
constexpr float REC_601_G = .587;
constexpr float REC_601_B = .114;
constexpr float REC_601_R = .299f;
constexpr float REC_601_G = .587f;
constexpr float REC_601_B = .114f;
// CIE 709 luminance factors
constexpr float REC_709_R = .2125;
constexpr float REC_709_G = .7154;
constexpr float REC_709_B = .0721;
constexpr float REC_709_R = .2125f;
constexpr float REC_709_G = .7154f;
constexpr float REC_709_B = .0721f;
#endif //KDENLIVE_COLORCONSTANTS_H
......@@ -51,10 +51,10 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
return parade;
}
const uint ww = (uint)paradeSize.width();
const uint wh = (uint)paradeSize.height();
const uint iw = (uint)image.bytesPerLine();
const uint ih = (uint)image.height();
const uint ww = uint(paradeSize.width());
const uint wh = uint(paradeSize.height());
const uint iw = uint(image.bytesPerLine());
const uint ih = uint(image.height());
const uint byteCount = iw * ih; // Note that 1 px = 4 B
const uchar offset = 10;
......@@ -66,14 +66,14 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
// Number of input pixels that will fall on one scope pixel.
// Must be a float because the acceleration factor can be high, leading to <1 expected px per px.
const float pixelDepth = (float)((byteCount >> 2) / accelFactor) / float(partW * 255);
const float pixelDepth = float((byteCount >> 2) / accelFactor) / (partW * 255);
const float gain = 255 / (8 * pixelDepth);
// qCDebug(KDENLIVE_LOG) << "Pixel depth: expected " << pixelDepth << "; Gain: using " << gain << " (acceleration: " << accelFactor << "x)";
QImage unscaled((int)ww - distRight, 256, QImage::Format_ARGB32);
QImage unscaled(int(ww) - distRight, 256, QImage::Format_ARGB32);
unscaled.fill(qRgba(0, 0, 0, 0));
const float wPrediv = (float)(partW - 1) / float((int)iw - 1);
const float wPrediv = float(partW - 1) / (iw - 1);
std::vector<std::vector<StructRGB>> paradeVals(partW, std::vector<StructRGB>(256, {0, 0, 0}));
......@@ -81,16 +81,16 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
const uint stepsize = uint(uint(image.depth() / 8) * accelFactor);
for (uint i = 0, x = 0; i < byteCount; i += stepsize) {
auto *col = (const QRgb *)(bits);
r = (uchar)qRed(*col);
g = (uchar)qGreen(*col);
b = (uchar)qBlue(*col);
auto *col = reinterpret_cast<const QRgb *>(bits);
r = uchar(qRed(*col));
g = uchar(qGreen(*col));
b = uchar(qBlue(*col));
double dx = x * (double)wPrediv;
double dx = x * double(wPrediv);
paradeVals[(size_t)dx][r].r++;
paradeVals[(size_t)dx][g].g++;
paradeVals[(size_t)dx][b].b++;
paradeVals[size_t(dx)][r].r++;
paradeVals[size_t(dx)][g].g++;
paradeVals[size_t(dx)][b].b++;
if (r < minR) {
minR = r;
......@@ -116,24 +116,24 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
x %= iw; // Modulo image width, to represent the current x position in the image
}
const int offset1 = (int)partW + (int)offset;
const int offset2 = 2 * (int)partW + 2 * (int)offset;
const int offset1 = int(partW + offset);
const int offset2 = int(2 * partW + 2 * offset);
switch (paintMode) {
case PaintMode_RGB:
for (int i = 0; i < (int)partW; ++i) {
for (int i = 0; i < int(partW); ++i) {
for (int j = 0; j < 256; ++j) {
unscaled.setPixel(i, j, qRgba(255, 10, 10, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].r)));
unscaled.setPixel(i + offset1, j, qRgba(10, 255, 10, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].g)));
unscaled.setPixel(i + offset2, j, qRgba(10, 10, 255, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].b)));
unscaled.setPixel(i, j, qRgba(255, 10, 10, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].r))));
unscaled.setPixel(i + offset1, j, qRgba(10, 255, 10, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].g))));
unscaled.setPixel(i + offset2, j, qRgba(10, 10, 255, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].b))));
}
}
break;
default:
for (int i = 0; i < (int)partW; ++i) {
for (int i = 0; i < int(partW); ++i) {
for (int j = 0; j < 256; ++j) {
unscaled.setPixel(i, j, qRgba(255, 255, 255, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].r)));
unscaled.setPixel(i + offset1, j, qRgba(255, 255, 255, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].g)));
unscaled.setPixel(i + offset2, j, qRgba(255, 255, 255, CHOP255(gain * (float)paradeVals[(size_t)i][(size_t)j].b)));
unscaled.setPixel(i, j, qRgba(255, 255, 255, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].r))));
unscaled.setPixel(i + offset1, j, qRgba(255, 255, 255, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].g))));
unscaled.setPixel(i + offset2, j, qRgba(255, 255, 255, CHOP255(gain * float(paradeVals[size_t(i)][size_t(j)].b))));
}
}
break;
......@@ -142,13 +142,13 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
// Scale the image to the target height. Scaling is not accomplished before because
// there are only 255 different values which would lead to gaps if the height is not exactly 255.
// Don't use bilinear transformation because the fast transformation meets the goal better.
davinci.drawImage(0, 0, unscaled.mirrored(false, true).scaled(unscaled.width(), (int)partH, Qt::IgnoreAspectRatio, Qt::FastTransformation));
davinci.drawImage(0, 0, unscaled.mirrored(false, true).scaled(unscaled.width(), int(partH), Qt::IgnoreAspectRatio, Qt::FastTransformation));
if (drawAxis) {
QRgb opx;
for (int i = 0; i <= 10; ++i) {
double dy = (float)i / 10. * float((int)partH - 1);
for (int x = 0; x < (int)ww - (int)distRight; ++x) {
int dy = i * int(partH - 1) / 10;
for (int x = 0; x < int(ww - distRight); ++x) {
opx = parade.pixel(x, dy);
parade.setPixel(x, dy, qRgba(CHOP255(150 + qRed(opx)), 255, CHOP255(200 + qBlue(opx)), CHOP255(32 + qAlpha(opx))));
}
......@@ -157,9 +157,9 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
if (drawGradientRef) {
davinci.setPen(colLight);
davinci.drawLine(0, (int)partH, (int)partW, 0);
davinci.drawLine((int)partW + (int)offset, (int)partH, 2 * (int)partW + (int)offset, 0);
davinci.drawLine(2 * (int)partW + 2 * (int)offset, (int)partH, 3 * (int)partW + 2 * (int)offset, 0);
davinci.drawLine(0, int(partH), int(partW), 0);
davinci.drawLine(int(partW + offset), int(partH), int(2 * partW + offset), 0);
davinci.drawLine(int(2 * partW + 2 * offset), int(partH), int(3 * partW + 2 * offset), 0);
}
const int d = 50;
......@@ -170,19 +170,19 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
} else {
davinci.setPen(colSoft);
}
davinci.drawText(0, (int)wh, i18n("min: "));
davinci.drawText(0, int(wh), i18n("min: "));
if (minG == 0) {
davinci.setPen(colHighlight);
} else {
davinci.setPen(colSoft);
}
davinci.drawText((int)partW + (int)offset, (int)wh, i18n("min: "));
davinci.drawText(int(partW + offset), int(wh), i18n("min: "));
if (minB == 0) {
davinci.setPen(colHighlight);
} else {
davinci.setPen(colSoft);
}
davinci.drawText(2 * (int)partW + 2 * (int)offset, (int)wh, i18n("min: "));
davinci.drawText(int(2 * partW + 2 * offset), int(wh), i18n("min: "));
// Show numerical maximum
if (maxR == 255) {
......@@ -190,28 +190,28 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
} else {
davinci.setPen(colSoft);
}
davinci.drawText(0, (int)wh - 20, i18n("max: "));
davinci.drawText(0, int(wh - 20), i18n("max: "));
if (maxG == 255) {
davinci.setPen(colHighlight);
} else {
davinci.setPen(colSoft);
}
davinci.drawText((int)partW + (int)offset, (int)wh - 20, i18n("max: "));
davinci.drawText(int(partW + offset), int(wh) - 20, i18n("max: "));
if (maxB == 255) {
davinci.setPen(colHighlight);
} else {
davinci.setPen(colSoft);
}
davinci.drawText(2 * (int)partW + 2 * (int)offset, (int)wh - 20, i18n("max: "));
davinci.drawText(int(2 * partW + 2 * offset), int(wh - 20), i18n("max: "));
davinci.setPen(colLight);
davinci.drawText(d, (int)wh, QString::number(minR, 'f', 0));
davinci.drawText((int)partW + (int)offset + d, (int)wh, QString::number(minG, 'f', 0));
davinci.drawText(2 * (int)partW + 2 * (int)offset + d, (int)wh, QString::number(minB, 'f', 0));
davinci.drawText(d, int(wh), QString::number(minR, 'f', 0));
davinci.drawText(int(partW + offset + d), int(wh), QString::number(minG, 'f', 0));
davinci.drawText(int(2 * partW + 2 * offset + d), int(wh), QString::number(minB, 'f', 0));
davinci.drawText(d, (int)wh - 20, QString::number(maxR, 'f', 0));
davinci.drawText((int)partW + (int)offset + d, (int)wh - 20, QString::number(maxG, 'f', 0));
davinci.drawText(2 * (int)partW + 2 * (int)offset + (int)d, (int)wh - 20, QString::number(maxB, 'f', 0));
davinci.drawText(d, int(wh - 20), QString::number(maxR, 'f', 0));
davinci.drawText(int(partW + offset + d), int(wh) - 20, QString::number(maxG, 'f', 0));
davinci.drawText(int(2 * partW + 2 * offset + d), int(wh - 20), QString::number(maxB, 'f', 0));
return parade;
}
......
......@@ -69,9 +69,9 @@ mRgb2YPbPr = r =
// The maximum distance from the center for any RGB color is 0.63, so
// no need to make the circle bigger than required.
const float SCALING = 1 / .7;
const double SCALING = 1 / .7;
const float VectorscopeGenerator::scaling = 1 / .7;
const double VectorscopeGenerator::scaling = 1 / .7;
/**
Input point is on [-1,1]², 0 being at the center,
......@@ -134,10 +134,10 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
// Just an average for the number of image pixels per scope pixel.
// NOTE: byteCount() has to be replaced by (img.bytesPerLine()*img.height()) for Qt 4.5 to compile, see:
// https://doc.qt.io/qt-5/qimage.html#bytesPerLine
double avgPxPerPx = (double)image.depth() / 8 * (image.bytesPerLine() * image.height()) / scope.size().width() / scope.size().height() / accelFactor;
double avgPxPerPx = double(image.depth()) / 8 * (image.bytesPerLine() * image.height()) / scope.size().width() / scope.size().height() / accelFactor;
for (int i = 0; i < (image.bytesPerLine() * image.height()); i += stepsize) {
auto *col = (const QRgb *)(bits);
auto *col = reinterpret_cast<const QRgb *>(bits);
int r = qRed(*col);
int g = qGreen(*col);
......@@ -146,18 +146,17 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
switch (colorSpace) {
case VectorscopeGenerator::ColorSpace_YUV:
// y = (double) 0.001173 * r +0.002302 * g +0.0004471* b;
u = (double)-0.0005781 * r - 0.001135 * g + 0.001713 * b;
v = (double)0.002411 * r - 0.002019 * g - 0.0003921 * b;
u = -0.0005781 * r - 0.001135 * g + 0.001713 * b;
v = 0.002411 * r - 0.002019 * g - 0.0003921 * b;
break;
case VectorscopeGenerator::ColorSpace_YPbPr:
default:
// y = (double) 0.001173 * r +0.002302 * g +0.0004471* b;
u = (double)-0.0006671 * r - 0.001299 * g + 0.0019608 * b;
v = (double)0.001961 * r - 0.001642 * g - 0.0003189 * b;
u = -0.0006671 * r - 0.001299 * g + 0.0019608 * b;
v = 0.001961 * r - 0.001642 * g - 0.0003189 * b;
break;
}
pt = mapToCircle(vectorscopeSize, QPointF(SCALING * gain * u, SCALING * gain * v));
pt = mapToCircle(vectorscopeSize, QPointF(SCALING * double(gain) * u, SCALING * double(gain) * v));
if (pt.x() >= scope.width() || pt.x() < 0 || pt.y() >= scope.height() || pt.y() < 0) {
// Point lies outside (because of scaling), don't plot it
......@@ -178,7 +177,6 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
db = dy + 517.2 * u;
break;
case VectorscopeGenerator::ColorSpace_YPbPr:
default:
dr = dy + 357.5 * v;
dg = dy - 87.75 * u - 182 * v;
db = dy + 451.9 * u;
......@@ -204,7 +202,7 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
db = 255;
}
scope.setPixel(pt, qRgba(dr, dg, db, 255));
scope.setPixel(pt, qRgba(int(dr), int(dg), int(db), 255));
break;
case PaintMode_Chroma:
......@@ -218,7 +216,6 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
db = dy + 517.2 * u;
break;
case VectorscopeGenerator::ColorSpace_YPbPr:
default:
dr = dy + 357.5 * v;
dg = dy - 87.75 * u - 182 * v;
db = dy + 451.9 * u;
......@@ -239,21 +236,25 @@ QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize,
dg *= dmax;
db *= dmax;
scope.setPixel(pt, qRgba(dr, dg, db, 255));
scope.setPixel(pt, qRgba(int(dr), int(dg), int(db), 255));
break;
case PaintMode_Original:
scope.setPixel(pt, *col);
break;
case PaintMode_Green:
px = scope.pixel(pt);
scope.setPixel(pt, qRgba(qRed(px) + (255 - qRed(px)) / (3 * avgPxPerPx), qGreen(px) + 20 * (255 - qGreen(px)) / (avgPxPerPx),
qBlue(px) + (255 - qBlue(px)) / (avgPxPerPx), qAlpha(px) + (255 - qAlpha(px)) / (avgPxPerPx)));
scope.setPixel(pt, qRgba(qRed(px) + int((255 - qRed(px)) / (3 * avgPxPerPx)),
qGreen(px) + int(20 * (255 - qGreen(px)) / (avgPxPerPx)),
qBlue(px) + int((255 - qBlue(px)) / (avgPxPerPx)),
qAlpha(px) + int((255 - qAlpha(px)) / (avgPxPerPx))));
break;
case PaintMode_Green2:
px = scope.pixel(pt);
scope.setPixel(pt,
qRgba(qRed(px) + ceil((255 - (float)qRed(px)) / (4 * avgPxPerPx)), 255,
qBlue(px) + ceil((255 - (float)qBlue(px)) / (avgPxPerPx)), qAlpha(px) + ceil((255 - (float)qAlpha(px)) / (avgPxPerPx))));
qRgba(qRed(px) + int((255 - qRed(px)) / (4 * avgPxPerPx)),
255,
qBlue(px) + int((255 - qBlue(px)) / (avgPxPerPx)),
qAlpha(px) + int((255 - qAlpha(px)) / (avgPxPerPx))));
break;
case PaintMode_Black:
px = scope.pixel(pt);
......
......@@ -31,7 +31,7 @@ public:
const VectorscopeGenerator::ColorSpace &colorSpace, bool, uint accelFactor = 1) const;
QPoint mapToCircle(const QSize &targetSize, const QPointF &point) const;
static const float scaling;
static const double scaling;
signals:
void signalCalculationFinished(const QImage &image, uint ms);
......
......@@ -20,7 +20,7 @@
#include <QElapsedTimer>
#include <vector>
#define CHOP255(a) ((255) < (a) ? (255) : (a))
#define CHOP255(a) int((255) < (a) ? (255) : (a))
WaveformGenerator::WaveformGenerator() = default;
......@@ -43,55 +43,55 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm
// Fill with transparent color
wave.fill(qRgba(0, 0, 0, 0));
const uint ww = (uint)waveformSize.width();
const uint wh = (uint)waveformSize.height();
const uint iw = (uint)image.bytesPerLine();
const uint ih = (uint)image.height();
const uint ww = uint(waveformSize.width());
const uint wh = uint(waveformSize.height());
const uint iw = uint(image.bytesPerLine());
const uint ih = uint(image.height());
const uint byteCount = iw * ih;
std::vector<std::vector<uint>> waveValues((size_t)waveformSize.width(), std::vector<uint>((size_t)waveformSize.height(), 0));
std::vector<std::vector<uint>> waveValues(size_t(waveformSize.width()), std::vector<uint>(size_t(waveformSize.height()), 0));
// Number of input pixels that will fall on one scope pixel.
// Must be a float because the acceleration factor can be high, leading to <1 expected px per px.
const float pixelDepth = (float)((byteCount >> 2) / accelFactor) / float(ww * wh);
const float gain = 255. / (8. * pixelDepth);
const float pixelDepth = float((byteCount >> 2) / accelFactor) / (ww * wh);
const float gain = 255.f / (8 * pixelDepth);
// qCDebug(KDENLIVE_LOG) << "Pixel depth: expected " << pixelDepth << "; Gain: using " << gain << " (acceleration: " << accelFactor << "x)";
// Subtract 1 from sizes because we start counting from 0.
// Not doing it would result in attempts to paint outside of the image.
const float hPrediv = (float)(wh - 1) / 255.;
const float wPrediv = (float)(ww - 1) / float(iw - 1);
const float hPrediv = (wh - 1) / 255.f;
const float wPrediv = (ww - 1) / float(iw - 1);
const uchar *bits = image.bits();
const int bpp = image.depth() / 8;
for (uint i = 0, x = 0; i < byteCount; i += (uint)bpp) {
for (uint i = 0, x = 0; i < byteCount; i += uint(bpp)) {
Q_ASSERT(bits < image.bits() + byteCount);
double dY, dx, dy;
auto *col = (const QRgb *)bits;
float dY, dx, dy;
auto *col = reinterpret_cast<const QRgb *>(bits);
if (rec == ITURec::Rec_601) {
// CIE 601 Luminance
dY = REC_601_R * float(qRed(*col)) + REC_601_G * float(qGreen(*col)) + REC_601_B * float(qBlue(*col));
dY = REC_601_R * qRed(*col) + REC_601_G * qGreen(*col) + REC_601_B * qBlue(*col);
} else {
// CIE 709 Luminance
dY = REC_709_R * float(qRed(*col)) + REC_709_G * float(qGreen(*col)) + REC_709_B * float(qBlue(*col));
dY = REC_709_R * qRed(*col) + REC_709_G * qGreen(*col) + REC_709_B * qBlue(*col);
}
// dY is on [0,255] now.
dy = dY * hPrediv;
dx = (float)x * wPrediv;
waveValues[(size_t)dx][(size_t)dy]++;
dx = x * wPrediv;
waveValues[size_t(dx)][size_t(dy)]++;
bits += bpp;
x += (uint)bpp;
x += uint(bpp);
if (x > iw) {
x -= iw;
if (accelFactor > 1) {
bits += bpp * (int)iw * ((int)accelFactor - 1);
i += (uint)bpp * iw * (accelFactor - 1);
bits += bpp * int(iw * (accelFactor - 1));
i += uint(bpp) * iw * (accelFactor - 1);
}
}
}
......@@ -102,24 +102,24 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm
for (int j = 0; j < waveformSize.height(); ++j) {
// Logarithmic scale. Needs fine tuning by hand, but looks great.
wave.setPixel(i, waveformSize.height() - j - 1,
qRgba(CHOP255(52 * log(0.1 * gain * (float)waveValues[(size_t)i][(size_t)j])),
CHOP255(52 * std::log(gain * (float)waveValues[(size_t)i][(size_t)j])),
CHOP255(52 * log(.25 * gain * (float)waveValues[(size_t)i][(size_t)j])),
CHOP255(64 * std::log(gain * (float)waveValues[(size_t)i][(size_t)j]))));
qRgba(CHOP255(52 * logf(0.1f * gain * float(waveValues[size_t(i)][size_t(j)]))),
CHOP255(52 * logf( gain * float(waveValues[size_t(i)][size_t(j)]))),
CHOP255(52 * logf(.25f * gain * float(waveValues[size_t(i)][size_t(j)]))),
CHOP255(64 * logf( gain * float(waveValues[size_t(i)][size_t(j)])))));
}
}
break;
case PaintMode_Yellow:
for (int i = 0; i < waveformSize.width(); ++i) {
for (int j = 0; j < waveformSize.height(); ++j) {
wave.setPixel(i, waveformSize.height() - j - 1, qRgba(255, 242, 0, CHOP255(gain * (float)waveValues[(size_t)i][(size_t)j])));
wave.setPixel(i, waveformSize.height() - j - 1, qRgba(255, 242, 0, CHOP255(gain * float(waveValues[size_t(i)][size_t(j)]))));
}
}
break;
default:
for (int i = 0; i < waveformSize.width(); ++i) {
for (int j = 0; j < waveformSize.height(); ++j) {
wave.setPixel(i, waveformSize.height() - j - 1, qRgba(255, 255, 255, CHOP255(2. * gain * (float)waveValues[(size_t)i][(size_t)j])));
wave.setPixel(i, waveformSize.height() - j - 1, qRgba(255, 255, 255, CHOP255(2.f * gain * float(waveValues[size_t(i)][size_t(j)]))));
}
}
break;
......@@ -137,8 +137,8 @@ QImage WaveformGenerator::calculateWaveform(const QSize &waveformSize, const QIm
davinci.setPen(qRgba(150, 255, 200, 32));
davinci.setCompositionMode(QPainter::CompositionMode_Overlay);
for (int i = 0; i <= 10; ++i) {
float dy = (float)i / 10. * ((int)wh - 1);
for (int x = 0; x < (int)ww; ++x) {
int dy = int(i / 10.f * (wh - 1));
for (int x = 0; x < int(ww); ++x) {
opx = wave.pixel(x, dy);
wave.setPixel(x, dy, qRgba(CHOP255(150 + qRed(opx)), 255, CHOP255(200 + qBlue(opx)), CHOP255(32 + qAlpha(opx))));
}
......
......@@ -218,7 +218,7 @@ QList<int> TimelineModel::getTracksIds(bool audio) const
int TimelineModel::getTrackIndexFromPosition(int pos) const
{
Q_ASSERT(pos >= 0 && pos < (int)m_allTracks.size());
Q_ASSERT(pos >= 0 && pos < m_allTracks.size());
READ_LOCK();
auto it = m_allTracks.cbegin();
while (pos > 0) {
......@@ -395,7 +395,7 @@ int TimelineModel::getTrackPosition(int trackId) const
READ_LOCK();
Q_ASSERT(isTrack(trackId));
auto it = m_allTracks.cbegin();
int pos = (int)std::distance(it, (decltype(it))m_iteratorTable.at(trackId));
int pos = int(std::distance(it, static_cast<decltype(it)>(m_iteratorTable.at(trackId))));
return pos;
}
......@@ -1076,6 +1076,7 @@ bool TimelineModel::requestSubtitleMove(int clipId, int position, bool updateVie
bool TimelineModel::requestSubtitleMove(int clipId, int position, bool updateView, bool first, bool last, bool invalidateTimeline, Fun &undo, Fun &redo)
{
Q_UNUSED(invalidateTimeline)
QWriteLocker locker(&m_lock);
GenTime oldPos = m_allSubtitles.at(clipId);
GenTime newPos(position, pCore->getCurrentFps());
......@@ -1784,6 +1785,7 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
bool TimelineModel::requestItemDeletion(int itemId, Fun &undo, Fun &redo, bool logUndo)
{
Q_UNUSED(logUndo)
QWriteLocker locker(&m_lock);
if (m_groups->isInGroup(itemId)) {
return requestGroupDeletion(itemId, undo, redo);
......@@ -2283,7 +2285,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
while (i.hasNext()) {
i.next();
// Delete mix
bool res = getTrackById(i.value())->requestRemoveMix(i.key(), local_undo, local_redo);
getTrackById(i.value())->requestRemoveMix(i.key(), local_undo, local_redo);
}
}
......@@ -2695,6 +2697,7 @@ const std::vector<int> TimelineModel::getBoundaries(int itemId)
int TimelineModel::requestClipResizeAndTimeWarp(int itemId, int size, bool right, int snapDistance, bool allowSingleResize, double speed)
{
Q_UNUSED(snapDistance)
QWriteLocker locker(&m_lock);
TRACE(itemId, size, right, true, snapDistance, allowSingleResize);
Q_ASSERT(isClip(itemId));
......@@ -2998,7 +3001,7 @@ int TimelineModel::requestItemResize(int itemId, int size, bool right, bool logU
std::pair<MixInfo, MixInfo> mixData = getTrackById_const(tid)->getMixInfo(id);
if (end - offset <= mixData.second.secondClipInOut.first + m_allClips[mixData.second.secondClipId]->getMixDuration() - m_allClips[mixData.second.secondClipId]->getMixCutPosition()) {
// Resized outside mix
bool res = removeMixWithUndo(mixData.second.secondClipId, undo, redo);
removeMixWithUndo(mixData.second.secondClipId, undo, redo);
Fun sync_mix_undo = [this, tid, mixData]() {
getTrackById_const(tid)->createMix(mixData.second, getTrackById_const(tid)->isAudioTrack());
getTrackById_const(tid)->syncronizeMixes(true);
......@@ -3322,13 +3325,13 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
{
// TODO: make sure we disable overlayTrack before inserting a track
if (position == -1) {
position = (int)(m_allTracks.size());
position = int(m_allTracks.size());
}
if (position < 0 || position > (int)m_allTracks.size()) {
if (position < 0 || position > int(m_allTracks.size())) {
return false;
}
int previousId = -1;
if (position < (int)m_allTracks.size()) {
if (position < int(m_allTracks.size())) {
previousId = getTrackIndexFromPosition(position);
}
int trackId = TimelineModel::getNextId();
......@@ -3367,7 +3370,7 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
emit dataChanged(ix, ix, {TimelineModel::TrackTagRole});
}
} else {
for (int i = position; i < (int)m_allTracks.size(); i++) {
for (int i = position; i < int(m_allTracks.size()); i++) {
QModelIndex ix = makeTrackIndexFromID(getTrackIndexFromPosition(i));
emit dataChanged(ix, ix, {TimelineModel::TrackTagRole});
}
......@@ -3560,7 +3563,7 @@ void TimelineModel::registerTrack(std::shared_ptr<TrackModel> track, int pos, bo
Q_ASSERT(m_iteratorTable.count(id) == 0); // check that id is not used (shouldn't happen)
m_iteratorTable[id] = it;
endInsertRows();
int cache = (int)QThread::idealThreadCount() + ((int)m_allTracks.size() + 1) * 2;
int cache = int(QThread::idealThreadCount()) + int(m_allTracks.size() + 1) * 2;
mlt_service_cache_set_size(nullptr, "producer_avformat", qMax(4, cache));
}
......@@ -3585,7 +3588,7 @@ void TimelineModel::registerSubtitle(int id, GenTime startTime, bool temporary)
int TimelineModel::positionForIndex(int id)
{
return std::distance(m_allSubtitles.begin(),m_allSubtitles.find(id));
return int(std::distance(m_allSubtitles.begin(),m_allSubtitles.find(id)));
}