mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 19:19:10 +00:00
Fix #312: scaling still wrong
This commit is contained in:
@@ -36,10 +36,10 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
|||||||
|
|
||||||
public override Task<BitmapSource> GetThumbnail(Size size, Size fullSize)
|
public override Task<BitmapSource> GetThumbnail(Size size, Size fullSize)
|
||||||
{
|
{
|
||||||
var decodeWidth = Math.Round(fullSize.Width *
|
var decodeWidth = (int) Math.Round(fullSize.Width *
|
||||||
Math.Min(size.Width / 2 / fullSize.Width, size.Height / 2 / fullSize.Height));
|
Math.Min(size.Width / 2 / fullSize.Width,
|
||||||
var scale = fullSize.Width / decodeWidth;
|
size.Height / 2 / fullSize.Height));
|
||||||
var decodeHeight = Math.Round(fullSize.Height / scale);
|
var decodeHeight = (int) Math.Round(fullSize.Height / fullSize.Width * decodeWidth);
|
||||||
|
|
||||||
return new Task<BitmapSource>(() =>
|
return new Task<BitmapSource>(() =>
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,8 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
|
|||||||
(int) decodeHeight; // specific size to avoid .net's double to int conversion
|
(int) decodeHeight; // specific size to avoid .net's double to int conversion
|
||||||
img.EndInit();
|
img.EndInit();
|
||||||
|
|
||||||
var scaled = new TransformedBitmap(img, new ScaleTransform(scale, scale));
|
var scaled = new TransformedBitmap(img,
|
||||||
|
new ScaleTransform(fullSize.Width / decodeWidth, fullSize.Height / decodeHeight));
|
||||||
scaled.Freeze();
|
scaled.Freeze();
|
||||||
return scaled;
|
return scaled;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user