diff --git a/CUE4Parse b/CUE4Parse index 1ac4640c..73c12732 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 1ac4640cdb0ba718cf26766029c67d5375465b9d +Subproject commit 73c12732922e4ad797c522895382a0b1a2c01a24 diff --git a/FModel/Creator/Bases/FN/BasePlaylist.cs b/FModel/Creator/Bases/FN/BasePlaylist.cs index b33a2761..715316d6 100644 --- a/FModel/Creator/Bases/FN/BasePlaylist.cs +++ b/FModel/Creator/Bases/FN/BasePlaylist.cs @@ -38,7 +38,9 @@ namespace FModel.Creator.Bases.FN !_apiEndpointView.FortniteApi.TryGetBytes(playlist.Data.Images.Showcase, out var image)) return; - Preview = Utils.GetBitmap(image).Resize(1024, 512); // Force size to 1024x512 to prevent huge previews. + Preview = Utils.GetBitmap(image).ResizeWithRatio(1024, 512); + Width = Preview.Width; + Height = Preview.Height; } public override SKImage Draw() diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 8fd0f843..0b965013 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -108,7 +108,6 @@ namespace FModel.Creator public static SKBitmap GetBitmap(byte[] data) => SKBitmap.Decode(data); public static SKBitmap Resize(this SKBitmap me, int size) => me.Resize(size, size); - public static SKBitmap Resize(this SKBitmap me, int width, int height) { var bmp = new SKBitmap(new SKImageInfo(width, height), SKBitmapAllocFlags.ZeroPixels); @@ -116,6 +115,13 @@ namespace FModel.Creator me.ScalePixels(pixmap, SKFilterQuality.Medium); return bmp; } + public static SKBitmap ResizeWithRatio(this SKBitmap me, double width, double height) + { + var ratioX = width / me.Width; + var ratioY = height / me.Height; + var ratio = ratioX < ratioY ? ratioX : ratioY; + return me.Resize(Convert.ToInt32(me.Width * ratio), Convert.ToInt32(me.Height * ratio)); + } public static bool TryGetPackageIndexExport(FPackageIndex packageIndex, out T export) where T : UObject { diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 7e14e14c..9397ff0f 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -535,4 +535,4 @@ namespace FModel.Settings set => SetProperty(ref _textureExportFormat, value); } } -} +} \ No newline at end of file diff --git a/FModel/ViewModels/GameSelectorViewModel.cs b/FModel/ViewModels/GameSelectorViewModel.cs index e2211604..1a982dc5 100644 --- a/FModel/ViewModels/GameSelectorViewModel.cs +++ b/FModel/ViewModels/GameSelectorViewModel.cs @@ -183,4 +183,4 @@ namespace FModel.ViewModels } #pragma warning restore 649 } -} +} \ No newline at end of file