diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-11 12:24:48 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-11 10:17:52 +0000 |
commit | 3b3959198c05b4ec35671b110902a07a05a802f2 (patch) | |
tree | a590e2c0296abe7fc573d2749577067dcc1b5138 /tools/qmleasing | |
parent | 4fcd5472233fa4afe3962207af5df4f55f1af276 (diff) |
SplineEditor: replace QList with QVector
There are only appending operations, and
QList is optimized for types with sizeof(void*),
so storing qreal or QPointF in QList is inefficient.
Change-Id: Ic2f216fa81549bfb8790c6ff58dd6053c776c297
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmleasing')
-rw-r--r-- | tools/qmleasing/splineeditor.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index 78ed9606db..ab22d579f8 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -34,6 +34,7 @@ #include <QContextMenuEvent> #include <QDebug> #include <QApplication> +#include <QVector> const int canvasWidth = 640; const int canvasHeight = 320; @@ -677,7 +678,7 @@ void SplineEditor::setEasingCurve(const QString &code) cleanCode.chop(1); const QStringList stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts); if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) { - QList<qreal> realList; + QVector<qreal> realList; realList.reserve(stringList.count()); foreach (const QString &string, stringList) { bool ok; @@ -685,12 +686,12 @@ void SplineEditor::setEasingCurve(const QString &code) if (!ok) return; } - QList<QPointF> points; + QVector<QPointF> points; const int count = realList.count() / 2; points.reserve(count); for (int i = 0; i < count; ++i) points.append(QPointF(realList.at(i * 2), realList.at(i * 2 + 1))); - if (points.last() == QPointF(1.0, 1.0)) { + if (points.constLast() == QPointF(1.0, 1.0)) { QEasingCurve easingCurve(QEasingCurve::BezierSpline); for (int i = 0; i < points.count() / 3; ++i) { |