diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-25 12:06:48 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-04-03 11:00:05 +0300 |
commit | b4d54648c4a25771d9450cb78ca38a2d6cfe1b69 (patch) | |
tree | cbcb64f40cbf3187fe3c433c45d4468c9e23ad91 | |
parent | 4540e917736ba8f7fa187dd6c93ef62e91b37d01 (diff) |
Don't save minCacheSize and properly initialize maxCacheSize
minCacheSize wasn't used anywhere and a maxCacheSize <= 0 is useless
and may lead to wrong height values for cache events.
Change-Id: Iee8c95197a7851bd41238e8e465bf6fd5b994573
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | plugins/qmlprofilerextension/pixmapcachemodel.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index f5d08083e8..7e04f51b39 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -67,7 +67,7 @@ class PixmapCacheModel::PixmapCacheModelPrivate : SingleCategoryTimelineModel::SingleCategoryTimelineModelPrivate> { public: - void computeCacheSizes(); + void computeMaxCacheSize(); void resizeUnfinishedLoads(); void flattenLoads(); void computeRowCounts(); @@ -79,7 +79,6 @@ public: int collapsedRowCount; void addVP(QVariantList &l, QString label, qint64 time) const; - qint64 minCacheSize; qint64 maxCacheSize; private: Q_DECLARE_PUBLIC(PixmapCacheModel) @@ -93,6 +92,7 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent) Q_D(PixmapCacheModel); d->collapsedRowCount = 1; d->expandedRowCount = 1; + d->maxCacheSize = 1; } int PixmapCacheModel::categoryDepth(int categoryIndex) const @@ -484,7 +484,7 @@ void PixmapCacheModel::loadData() d->resizeUnfinishedLoads(); - d->computeCacheSizes(); + d->computeMaxCacheSize(); d->flattenLoads(); d->computeRowCounts(); d->computeNesting(); @@ -499,20 +499,18 @@ void PixmapCacheModel::clear() d->pixmaps.clear(); d->collapsedRowCount = 1; d->expandedRowCount = 1; + d->maxCacheSize = 1; d->expanded = false; d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); } -void PixmapCacheModel::PixmapCacheModelPrivate::computeCacheSizes() +void PixmapCacheModel::PixmapCacheModelPrivate::computeMaxCacheSize() { - minCacheSize = -1; - maxCacheSize = -1; + maxCacheSize = 1; foreach (const PixmapCacheModel::PixmapCacheEvent &event, ranges) { if (event.pixmapEventType == PixmapCacheModel::PixmapCacheCountChanged) { - if (minCacheSize == -1 || event.cacheSize < minCacheSize) - minCacheSize = event.cacheSize; - if (maxCacheSize == -1 || event.cacheSize > maxCacheSize) + if (event.cacheSize > maxCacheSize) maxCacheSize = event.cacheSize; } } |