Commit bc689377 authored by Ulf Hermann's avatar Ulf Hermann

Timeline: Use QHash instead of QVector for child render states

The offsets can get very large if you have long traces or zoom in very
closely. We hardly ever need more than a few on each level, so this is
just a waste of memory. Also, use 64bit integers to index them, as we
can get very close to the numerical limit with 32bit ones.

Change-Id: I20db4ea5dd2ea8922fa6552c106194bb4f19a76b
Task-number: QTCREATORBUG-14105
Reviewed-by: default avatarKai Koehne <kai.koehne@theqtcompany.com>
parent 2ae8ae5d
......@@ -73,9 +73,9 @@ void TimelineRenderer::TimelineRendererPrivate::resetCurrentSelection()
TimelineRenderState *TimelineRenderer::TimelineRendererPrivate::findRenderState()
{
int newLevel = 0;
int newOffset = 0;
qint64 newOffset = 0;
int level;
int offset;
qint64 offset;
qint64 newStart = zoomer->traceStart();
qint64 newEnd = zoomer->traceEnd();
......@@ -97,8 +97,6 @@ TimelineRenderState *TimelineRenderer::TimelineRendererPrivate::findRenderState(
if (renderStates.length() <= level)
renderStates.resize(level + 1);
if (renderStates[level].length() <= offset)
renderStates[level].resize(offset + 1);
TimelineRenderState *state = renderStates[level][offset];
if (state == 0) {
state = new TimelineRenderState(start, end, 1.0 / static_cast<qreal>(SafeFloatMax),
......@@ -124,8 +122,8 @@ QSGNode *TimelineRenderer::updatePaintNode(QSGNode *node, UpdatePaintNodeData *u
if (d->modelDirty) {
if (node)
node->removeAllChildNodes();
foreach (QVector<TimelineRenderState *> stateVector, d->renderStates)
qDeleteAll(stateVector);
for (auto i = d->renderStates.begin(); i != d->renderStates.end(); ++i)
qDeleteAll(*i);
d->renderStates.clear();
d->lastState = 0;
}
......
......@@ -59,7 +59,7 @@ public:
int eventIndex;
} currentSelection;
QVector<QVector<TimelineRenderState *> > renderStates;
QVector<QHash<qint64, TimelineRenderState *> > renderStates;
TimelineRenderState *lastState;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment