mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Optimize SolidColorBrush usage for window background
Freeze SolidColorBrush instances before assigning them to mainWindow.Background to improve performance and immutability. Applied to both transparent and selected background scenarios.
This commit is contained in:
parent
428a7ad0c2
commit
4767b444ec
1 changed files with 6 additions and 2 deletions
|
|
@ -1036,11 +1036,15 @@ namespace Flow.Launcher.Core.Resource
|
|||
// Only set the background to transparent if the theme supports blur
|
||||
if (backdropType == BackdropTypes.Mica || backdropType == BackdropTypes.MicaAlt)
|
||||
{
|
||||
mainWindow.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
|
||||
var backgroundBrush = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
|
||||
backgroundBrush.Freeze();
|
||||
mainWindow.Background = backgroundBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.Background = new SolidColorBrush(selectedBG);
|
||||
var backgroundBrush = new SolidColorBrush(selectedBG);
|
||||
backgroundBrush.Freeze();
|
||||
mainWindow.Background = backgroundBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue