Commit f1c90489 authored by Stefan Brüns's avatar Stefan Brüns Committed by David Faure
Browse files

Try fallback to large thumbnail if small one is not available

Scaling down a large thumbnail is considerably faster than creating the
thumbnail from scratch.
parent 0b9a5372
......@@ -703,7 +703,18 @@ bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& fil
cacheSize = 256;
thumbPath.cd("large");
}
if (!thumbnail.load(thumbPath.absoluteFilePath(thumbName))) {
if (thumbnail.load(thumbPath.absoluteFilePath(thumbName))) {
return true;
} else if (cacheSize == 128) {
QDir fallbackPath(m_thumbBasePath);
fallbackPath.cd("large");
if (thumbnail.load(fallbackPath.absoluteFilePath(thumbName))) {
return true;
}
}
if (thumbnail.isNull()) {
// no cached version is available, a new thumbnail must be created
QSaveFile thumbnailfile(thumbPath.absoluteFilePath(thumbName));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment