share a single ItemIconCache across the UI
Four separate caches rasterized the same item SVGs, one of them rebuilt on every recipe-dialog open. MainWindow now owns one cache and hands a non-owning pointer to HeaderBar, BuildButtonGrid, GameWorldView and RecipeSelectionDialog. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GH8ZMRY3vhxxXcaUxBqxkk
This commit is contained in:
@@ -184,13 +184,12 @@ namespace
|
||||
|
||||
BuildButtonGrid::BuildButtonGrid(Simulation* sim, const GameConfig* config,
|
||||
const std::string& iconDir,
|
||||
const std::string& itemsIconDir, QWidget* parent)
|
||||
ItemIconCache* itemIcons, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_sim(sim)
|
||||
, m_config(config)
|
||||
, m_iconDir(iconDir)
|
||||
, m_itemIcons(std::make_unique<ItemIconCache>(
|
||||
QString::fromStdString(itemsIconDir)))
|
||||
, m_itemIcons(itemIcons)
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
layout->setSpacing(4);
|
||||
|
||||
Reference in New Issue
Block a user