diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-05-16 10:26:47 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-05-16 15:20:30 +0300 |
commit | afe88435094fbb1aa179baab5e2e16249258851a (patch) | |
tree | f1e723c3ae1deaefa63589635846985222bbf5e0 /core/imagedownloader.cpp | |
parent | c3c2c2f606268e1fd5c12268ee6ccdebc6d4653c (diff) | |
download | subsurface-afe88435094fbb1aa179baab5e2e16249258851a.tar.gz |
Dive pictures: don't attempt reading the same image twice
If loading of an image failed, we tried to see if we find a
canonical filename in the cache. There's no point in rereading
the picture if the canonical and the original filename are
the same.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/imagedownloader.cpp')
-rw-r--r-- | core/imagedownloader.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/imagedownloader.cpp b/core/imagedownloader.cpp index 372f5318a..faa0d7ff7 100644 --- a/core/imagedownloader.cpp +++ b/core/imagedownloader.cpp @@ -115,7 +115,6 @@ static std::pair<QImage,bool> getHashedImage(const QString &file_in, bool tryDow hashPicture(file); } else if (tryDownload) { // This did not load anything. Let's try to get the image from other sources - // Let's try to load it locally via its hash QString filenameLocal = localFilePath(qPrintable(file)); qDebug() << QStringLiteral("Translated filename: %1 -> %2").arg(file, filenameLocal); if (filenameLocal.isNull()) { @@ -125,8 +124,9 @@ static std::pair<QImage,bool> getHashedImage(const QString &file_in, bool tryDow loadPicture(file, true); stillLoading = true; } else { - // Load locally from translated file name - thumb = loadImage(filenameLocal); + // Load locally from translated file name if it is different + if (filenameLocal != file) + thumb = loadImage(filenameLocal); if (!thumb.isNull()) { // Make sure the hash still matches the image file hashPicture(filenameLocal); |