summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-06-01 13:32:03 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-06-01 13:36:29 (GMT)
commit2c8f9dee611ed403ef129d5e3a3f9f5883bfd08b (patch)
treea3cdac743800005db95f644b4ea8577775c408ff /src/gui/image
parentdab3121d59b202eac72a0b7d0fa101532ac080cd (diff)
downloadQt-2c8f9dee611ed403ef129d5e3a3f9f5883bfd08b.zip
Qt-2c8f9dee611ed403ef129d5e3a3f9f5883bfd08b.tar.gz
Qt-2c8f9dee611ed403ef129d5e3a3f9f5883bfd08b.tar.bz2
Some optimizations for QImage::load()
We didnt check if the file existed before trying to load it. This means that we had a lot of redundant dlopen calls for that case. In addition pixmap cache should be significantly faster now. Task-number: QTBUG-11137 Reviewed-by: joao
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 3013726..20e4b50 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -82,6 +82,7 @@
#endif
#include "qpixmap_raster_p.h"
+#include "private/qstylehelper_p.h"
QT_BEGIN_NAMESPACE
@@ -829,8 +830,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers
return false;
QFileInfo info(fileName);
- QString key = QLatin1String("qt_pixmap_") + info.absoluteFilePath() + QLatin1Char('_') + QString::number(info.lastModified().toTime_t()) + QLatin1Char('_') +
- QString::number(info.size()) + QLatin1Char('_') + QString::number(data ? data->pixelType() : QPixmapData::PixmapType);
+ if (!info.exists())
+ return false;
+
+ QString key = QLatin1Literal("qt_pixmap")
+ % info.absoluteFilePath()
+ % HexString<uint>(info.lastModified().toTime_t())
+ % HexString<quint64>(info.size())
+ % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType);
if (QPixmapCache::find(key, *this))
return true;