From b4d54648c4a25771d9450cb78ca38a2d6cfe1b69 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 25 Mar 2014 12:06:48 +0100 Subject: [PATCH] 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 --- .../qmlprofilerextension/pixmapcachemodel.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index f5d08083e83..7e04f51b391 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; } }