resize bitmapimage when not loading full image

This commit is contained in:
Hongtao Zhang 2022-10-30 11:11:15 -05:00
parent 2507d1abed
commit ba0aee14ba
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB

View file

@ -22,6 +22,7 @@ namespace Flow.Launcher.Infrastructure.Image
private static IImageHashGenerator _hashGenerator;
private static readonly bool EnableImageHash = true;
public static ImageSource DefaultImage { get; } = new BitmapImage(new Uri(Constant.MissingImgIcon));
public const int SmallIconSize = 32;
private static readonly string[] ImageExtensions =
@ -128,6 +129,11 @@ namespace Flow.Launcher.Infrastructure.Image
var image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
if (!loadFullImage)
{
image.DecodePixelHeight = SmallIconSize;
image.DecodePixelWidth = SmallIconSize;
}
image.StreamSource = buffer;
image.EndInit();
image.StreamSource = null;