X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fkis_cubic_curve.cpp;h=a0bc58c139db71231440ac75ebacdccc90da3567;hb=d20fa38526368d808a18d9558c25747bb731c38a;hp=f5177b1dee9bf4676df54f3b8300f32ea9168617;hpb=b73a3b2ffe141e5413e583091b355d8eb752aeb9;p=kdenlive diff --git a/src/kis_cubic_curve.cpp b/src/kis_cubic_curve.cpp index f5177b1d..a0bc58c1 100644 --- a/src/kis_cubic_curve.cpp +++ b/src/kis_cubic_curve.cpp @@ -24,6 +24,7 @@ #include #include #include +#include template class KisTridiagonalSystem @@ -125,8 +126,9 @@ protected: int m_intervals; public: - KisCubicSpline() {} - KisCubicSpline(const QList &a) { + KisCubicSpline() : m_begin(0), m_end(0), m_intervals(0) {} + KisCubicSpline(const QList &a) : m_begin(0), m_end(0), + m_intervals(0) { createSpline(a); } @@ -293,7 +295,7 @@ qreal KisCubicCurve::Data::value(qreal x) */ x = qBound(spline.begin(), x, spline.end()); qreal y = spline.getValue(x); - return qBound(0.0, y, 1.0); + return qBound((qreal)0.0, y, (qreal)1.0); } template @@ -306,7 +308,7 @@ void KisCubicCurve::Data::updateTransfer(QVector<_T_>* transfer, bool& valid, _T qreal end = 1.0 / (size - 1); for (int i = 0; i < size; ++i) { /* Direct uncached version */ - _T2_ val = value(i * end ) * max; + _T2_ val = value(i * end) * max; val = qBound(min, val, max); (*transfer)[i] = val; } @@ -322,9 +324,11 @@ KisCubicCurve::KisCubicCurve() : d(new Private) { d->data = new Data; QPointF p; - p.rx() = 0.0; p.ry() = 0.0; + p.rx() = 0.0; + p.ry() = 0.0; d->data->points.append(p); - p.rx() = 1.0; p.ry() = 1.0; + p.rx() = 1.0; + p.ry() = 1.0; d->data->points.append(p); } @@ -400,9 +404,10 @@ void KisCubicCurve::removePoint(int idx) QString KisCubicCurve::toString() const { QString sCurve; + QLocale locale; foreach(const QPointF & pair, d->data->points) { - sCurve += QString::number(pair.x()); - sCurve += ','; + sCurve += locale.toString(pair.x()); + sCurve += '/'; sCurve += QString::number(pair.y()); sCurve += ';'; } @@ -416,10 +421,10 @@ void KisCubicCurve::fromString(const QString& string) QList points; foreach(const QString & pair, data) { - if (pair.indexOf(',') > -1) { + if (pair.indexOf('/') > -1) { QPointF p; - p.rx() = pair.section(',', 0, 0).toDouble(); - p.ry() = pair.section(',', 1, 1).toDouble(); + p.rx() = pair.section('/', 0, 0).toDouble(); + p.ry() = pair.section('/', 1, 1).toDouble(); points.append(p); } }