diff --git a/src/qvimagecore.cpp b/src/qvimagecore.cpp index c46462e3..0a933997 100644 --- a/src/qvimagecore.cpp +++ b/src/qvimagecore.cpp @@ -477,8 +477,9 @@ void QVImageCore::addToCache(const ReadData &readData) return; QString cacheKey = getPixmapCacheKey(readData.absoluteFilePath, readData.fileSize, readData.targetColorSpace); + qint64 pixmapMemoryBytes = static_cast(readData.pixmap.width()) * readData.pixmap.height() * readData.pixmap.depth() / 8; - QVImageCore::pixmapCache.insert(cacheKey, new ReadData(readData), readData.fileSize/1024); + QVImageCore::pixmapCache.insert(cacheKey, new ReadData(readData), qMax(pixmapMemoryBytes / 1024, 1LL)); } QString QVImageCore::getPixmapCacheKey(const QString &absoluteFilePath, const qint64 &fileSize, const QColorSpace &targetColorSpace)