aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-02-14 14:04:14 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-02-14 16:51:47 +0000
commitdd6ffbec2496920b1bfe4f29cca1eba82e959869 (patch)
tree1c39ec7703af1fe7e5be0297a31af701cbabc695
parent57a7ec1c9d226e05e9453e17c582dc71c01185a0 (diff)
Optimize QQuickPixmapCache readImage() slightly
Calling QImageReader::size() twice means calling the image format plugin twice, so it's best to avoid that. Change-Id: I4741e87c7c95252904d0dd9f484a57d953670559 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/quick/util/qquickpixmapcache.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 2ae9debbc9..6a34169fce 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -427,11 +427,12 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e
imgio.setScaledSize(scSize);
if (!requestRegion.isNull())
imgio.setScaledClipRect(requestRegion);
+ const QSize originalSize = imgio.size();
qCDebug(lcImg) << url << "frame" << frame << "of" << imgio.imageCount()
- << "requestRegion" << requestRegion << "QImageReader size" << imgio.size() << "-> scSize" << scSize;
+ << "requestRegion" << requestRegion << "QImageReader size" << originalSize << "-> scSize" << scSize;
if (impsize)
- *impsize = imgio.size();
+ *impsize = originalSize;
if (imgio.read(image)) {
maybeRemoveAlpha(image);