UI: IconCache: Microoptimize file()

This commit is contained in:
Nodir Temirkhodjaev 2023-08-17 12:37:32 +05:00
parent d824118bbc
commit 7ea1d5247b

View File

@ -51,6 +51,8 @@ QPixmap IconCache::file(const QString &filePath)
{ {
checkThread(); checkThread();
QPixmap pixmap;
if (!find(filePath, &pixmap)) {
QString adjustedFilePath = filePath; QString adjustedFilePath = filePath;
// Try to use "./icons/" folder from current working dir. // Try to use "./icons/" folder from current working dir.
@ -62,10 +64,9 @@ QPixmap IconCache::file(const QString &filePath)
} }
} }
QPixmap pixmap;
if (!find(adjustedFilePath, &pixmap)) {
pixmap.load(adjustedFilePath); pixmap.load(adjustedFilePath);
insert(adjustedFilePath, pixmap);
insert(filePath, pixmap);
} }
return pixmap; return pixmap;
} }