Skip to content

Commit fc2e3fe

Browse files
committed
Improve ImageLoader performance
1 parent e50a277 commit fc2e3fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Flow.Launcher.Infrastructure/Image/ImageLoader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static class ImageLoader
2222
private static Lock storageLock { get; } = new();
2323
private static BinaryStorage<List<(string, bool)>> _storage;
2424
private static readonly ConcurrentDictionary<string, string> GuidToKey = new();
25-
private static IImageHashGenerator _hashGenerator;
25+
private static ImageHashGenerator _hashGenerator;
2626
private static readonly bool EnableImageHash = true;
2727
public static ImageSource Image => ImageCache[Constant.ImageIcon, false];
2828
public static ImageSource MissingImage => ImageCache[Constant.MissingImgIcon, false];
@@ -31,7 +31,7 @@ public static class ImageLoader
3131
public const int FullIconSize = 256;
3232
public const int FullImageSize = 320;
3333

34-
private static readonly string[] ImageExtensions = { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico" };
34+
private static readonly string[] ImageExtensions = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico"];
3535
private static readonly string SvgExtension = ".svg";
3636

3737
public static async Task InitializeAsync()
@@ -327,7 +327,7 @@ public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullI
327327
return img;
328328
}
329329

330-
private static ImageSource LoadFullImage(string path)
330+
private static BitmapImage LoadFullImage(string path)
331331
{
332332
BitmapImage image = new BitmapImage();
333333
image.BeginInit();
@@ -364,7 +364,7 @@ private static ImageSource LoadFullImage(string path)
364364
return image;
365365
}
366366

367-
private static ImageSource LoadSvgImage(string path, bool loadFullImage = false)
367+
private static RenderTargetBitmap LoadSvgImage(string path, bool loadFullImage = false)
368368
{
369369
// Set up drawing settings
370370
var desiredHeight = loadFullImage ? FullImageSize : SmallIconSize;

0 commit comments

Comments
 (0)