perf(themes): add pre-computed ABGR cache on theme records

This commit is contained in:
2026-05-07 15:28:47 +02:00
parent de9d1ac60b
commit 0d2ee63420
2 changed files with 51 additions and 0 deletions
+6
View File
@@ -25,6 +25,11 @@ public sealed class ThemeRegistry
{ ForgeMerchantman.Slug, ForgeMerchantman.Build() },
{ MintGrove.Slug, MintGrove.Build() },
};
// Centralised so the nine .Build() factories stay free of cache plumbing.
foreach (var theme in _builtIns.Values)
theme.RecomputeAbgrCache();
_active = _builtIns[DefaultSlug];
_customThemesDir = customThemesDir;
}
@@ -81,6 +86,7 @@ public sealed class ThemeRegistry
try
{
theme = ThemeJsonLoader.LoadFromFile(path);
theme.RecomputeAbgrCache();
_customCache[key] = (theme, stamp);
}
catch (Exception ex)