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:
@@ -32,10 +32,9 @@ const double HeaderBar::kSpeeds[] = { 0.0, 0.5, 1.0, 2.0, 10.0 };
|
||||
const int HeaderBar::kSpeedCount = 5;
|
||||
|
||||
HeaderBar::HeaderBar(const Simulation* sim, const GameConfig* config,
|
||||
const std::string& itemsIconDir, QWidget* parent)
|
||||
ItemIconCache* itemIcons, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_itemIcons(std::make_unique<ItemIconCache>(
|
||||
QString::fromStdString(itemsIconDir)))
|
||||
, m_itemIcons(itemIcons)
|
||||
, m_sim(sim)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
|
||||
Reference in New Issue
Block a user