From e3548873112e2126e13caf491a89508ea06af22a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 17 Sep 2015 20:50:25 +0200 Subject: [PATCH] Fix Image measurement. --- src/Perspex.Controls/Image.cs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/Perspex.Controls/Image.cs b/src/Perspex.Controls/Image.cs index 0782b51f2a..79b79c6141 100644 --- a/src/Perspex.Controls/Image.cs +++ b/src/Perspex.Controls/Image.cs @@ -73,29 +73,14 @@ namespace Perspex.Controls /// The desired size of the control. protected override Size MeasureOverride(Size availableSize) { - double width = 0; - double height = 0; - Vector scale = new Vector(); - if (Source != null) { - width = Source.PixelWidth; - height = Source.PixelHeight; - - if (Width > 0) - { - availableSize = new Size(Width, availableSize.Height); - } - - if (Height > 0) - { - availableSize = new Size(availableSize.Width, Height); - } - - scale = Stretch.CalculateScaling(availableSize, new Size(width, height)); + return new Size(Source.PixelWidth, Source.PixelHeight); + } + else + { + return new Size(); } - - return new Size(width * scale.X, height * scale.Y); } } } \ No newline at end of file