mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
c3c2c2f606
commit
afe8843509
1 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue