mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-11 08:54:33 +00:00
Qt: Don't use memcard icon cache for window icon when scaled
It'll get scaled up and down again otherwise.
This commit is contained in:
@@ -457,36 +457,36 @@ QIcon GameListModel::getIconForGame(const QString& path)
|
||||
{
|
||||
QIcon ret;
|
||||
|
||||
if (m_show_game_icons && !path.isEmpty())
|
||||
{
|
||||
const auto lock = GameList::GetLock();
|
||||
const GameList::Entry* entry = GameList::GetEntryForPath(path.toStdString());
|
||||
if (!entry)
|
||||
return ret;
|
||||
if (!m_show_game_icons || path.isEmpty())
|
||||
return ret;
|
||||
|
||||
const auto lock = GameList::GetLock();
|
||||
const GameList::Entry* entry = GameList::GetEntryForPath(path.toStdString());
|
||||
if (!entry || entry->serial.empty() || !entry->IsDisc() && !entry->IsDiscSet())
|
||||
return ret;
|
||||
|
||||
// Only use the cache if we're not using larger icons. Otherwise they'll get double scaled.
|
||||
// Provides a small performance boost when using default size icons.
|
||||
if (m_icon_size == MEMORY_CARD_ICON_SIZE)
|
||||
{
|
||||
if (const QPixmap* pm = m_memcard_pixmap_cache.Lookup(entry->serial))
|
||||
{
|
||||
// If we already have the icon cached, return it.
|
||||
ret = QIcon(*pm);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
// See above.
|
||||
const std::string icon_path = GameList::GetGameIconPath(entry->serial, entry->path);
|
||||
if (!icon_path.empty())
|
||||
{
|
||||
QPixmap newpm;
|
||||
if (!icon_path.empty() && newpm.load(QString::fromStdString(icon_path)))
|
||||
{
|
||||
// See above.
|
||||
if (!entry->serial.empty() && (entry->IsDisc() || entry->IsDiscSet()))
|
||||
{
|
||||
const std::string icon_path = GameList::GetGameIconPath(entry->serial, entry->path);
|
||||
if (!icon_path.empty())
|
||||
{
|
||||
QPixmap newpm;
|
||||
if (!icon_path.empty() && newpm.load(QString::fromStdString(icon_path)))
|
||||
{
|
||||
fixIconPixmapSize(newpm);
|
||||
ret = QIcon(*m_memcard_pixmap_cache.Insert(entry->serial, std::move(newpm)));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
fixIconPixmapSize(newpm);
|
||||
ret = QIcon(*m_memcard_pixmap_cache.Insert(entry->serial, std::move(newpm)));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -641,12 +641,12 @@ void MainWindow::onSystemDestroyed()
|
||||
switchToGameListView();
|
||||
}
|
||||
|
||||
void MainWindow::onSystemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title)
|
||||
void MainWindow::onSystemGameChanged(const QString& path, const QString& game_serial, const QString& game_title)
|
||||
{
|
||||
s_current_game_path = filename;
|
||||
s_current_game_path = path;
|
||||
s_current_game_title = game_title;
|
||||
s_current_game_serial = game_serial;
|
||||
s_current_game_icon = m_game_list_widget->getModel()->getIconForGame(filename);
|
||||
s_current_game_icon = m_game_list_widget->getModel()->getIconForGame(path);
|
||||
|
||||
updateWindowTitle();
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ private Q_SLOTS:
|
||||
void onSystemDestroyed();
|
||||
void onSystemPaused();
|
||||
void onSystemResumed();
|
||||
void onSystemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title);
|
||||
void onSystemGameChanged(const QString& path, const QString& game_serial, const QString& game_title);
|
||||
void onSystemUndoStateAvailabilityChanged(bool available, quint64 timestamp);
|
||||
void onMediaCaptureStarted();
|
||||
void onMediaCaptureStopped();
|
||||
|
||||
@@ -138,7 +138,7 @@ Q_SIGNALS:
|
||||
void systemDestroyed();
|
||||
void systemPaused();
|
||||
void systemResumed();
|
||||
void systemGameChanged(const QString& filename, const QString& game_serial, const QString& game_title);
|
||||
void systemGameChanged(const QString& path, const QString& game_serial, const QString& game_title);
|
||||
void systemUndoStateAvailabilityChanged(bool available, quint64 timestamp);
|
||||
void gameListRefreshed();
|
||||
void gameListRowsChanged(const QList<int>& rows_changed);
|
||||
|
||||
Reference in New Issue
Block a user