From 3297ccddf5f5234de5691f073507a5d88ccfeb04 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 6 Dec 2013 13:57:36 +0100 Subject: Correctly profile the size of loaded pixmaps Only set the sizes when they're known, prefer request size to implicit size (as the request size is what ends up in the cache), and don't set the size twice. Task-number: QTBUG-35337 Change-Id: Ie516a1cae2d9050f61362ee99cf8a6a9dd8ea3bb Reviewed-by: Gunnar Sletta --- src/quick/util/qquickpixmapcache.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 5bab131ee6..16ed94f91f 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -900,8 +900,7 @@ bool QQuickPixmapReply::event(QEvent *event) pixmapProfiler.finishLoading(data->url); data->textureFactory = de->textureFactory; data->implicitSize = de->implicitSize; - if (data->implicitSize.width() > 0) - pixmapProfiler.setSize(url, data->implicitSize.width(), data->implicitSize.height()); + pixmapProfiler.setSize(url, data->requestSize.width() > 0 ? data->requestSize : data->implicitSize); } else { pixmapProfiler.errorLoading(data->url); data->errorString = de->errorString; @@ -971,8 +970,6 @@ void QQuickPixmapData::addToCache() inCache = true; QQmlPixmapProfiler pixmapProfiler; pixmapProfiler.cacheCountChanged(url, pixmapStore()->m_cache.count()); - if (implicitSize.width() > 0) - pixmapProfiler.setSize(url, implicitSize.width(), implicitSize.height()); } } @@ -1259,8 +1256,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques d = createPixmapDataSync(this, engine, url, requestSize, &ok); if (ok) { pixmapProfiler.finishLoading(url); - if (d->implicitSize.width() > 0) - QQmlPixmapProfiler().setSize(url, d->implicitSize.width(), d->implicitSize.height()); + pixmapProfiler.setSize(url, d->requestSize.width() > 0 ? d->requestSize : d->implicitSize); if (options & QQuickPixmap::Cache) d->addToCache(); return; -- cgit v1.2.3