diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2013-12-06 13:57:36 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-09 09:51:16 +0100 |
commit | 3297ccddf5f5234de5691f073507a5d88ccfeb04 (patch) | |
tree | 9af4578e054f6e11da3ecafcdc217402a7eae2bd /src | |
parent | 9b6e686ed793c556983f4e835134bdff07f09e42 (diff) |
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 <gunnar.sletta@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/debugger/qqmlprofilerservice_p.h | 6 | ||||
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 8 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index c2e9eb421a..5959a526bb 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -381,9 +381,9 @@ struct QQmlPixmapProfiler { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount); } } - void setSize(const QUrl &pixmapUrl, int width, int height) { - if (enabled) { - QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height); + void setSize(const QUrl &pixmapUrl, const QSize &size) { + if (enabled && size.width() > 0) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, size.width(), size.height()); } } 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; |