mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve ImageLoader performance
This commit is contained in:
parent
e50a2772f8
commit
fc2e3fec63
1 changed files with 4 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
private static Lock storageLock { get; } = new();
|
||||
private static BinaryStorage<List<(string, bool)>> _storage;
|
||||
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
|
||||
private static IImageHashGenerator _hashGenerator;
|
||||
private static ImageHashGenerator _hashGenerator;
|
||||
private static readonly bool EnableImageHash = true;
|
||||
public static ImageSource Image => ImageCache[Constant.ImageIcon, false];
|
||||
public static ImageSource MissingImage => ImageCache[Constant.MissingImgIcon, false];
|
||||
|
|
@ -31,7 +31,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
public const int FullIconSize = 256;
|
||||
public const int FullImageSize = 320;
|
||||
|
||||
private static readonly string[] ImageExtensions = { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico" };
|
||||
private static readonly string[] ImageExtensions = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico"];
|
||||
private static readonly string SvgExtension = ".svg";
|
||||
|
||||
public static async Task InitializeAsync()
|
||||
|
|
@ -327,7 +327,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
return img;
|
||||
}
|
||||
|
||||
private static ImageSource LoadFullImage(string path)
|
||||
private static BitmapImage LoadFullImage(string path)
|
||||
{
|
||||
BitmapImage image = new BitmapImage();
|
||||
image.BeginInit();
|
||||
|
|
@ -364,7 +364,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
|||
return image;
|
||||
}
|
||||
|
||||
private static ImageSource LoadSvgImage(string path, bool loadFullImage = false)
|
||||
private static RenderTargetBitmap LoadSvgImage(string path, bool loadFullImage = false)
|
||||
{
|
||||
// Set up drawing settings
|
||||
var desiredHeight = loadFullImage ? FullImageSize : SmallIconSize;
|
||||
|
|
|
|||
Loading…
Reference in a new issue