Skip to content

Commit

Permalink
[WPF] Fix swapped sizes in high-DPI image scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
sevoku committed Nov 20, 2015
1 parent 8f3b4d0 commit c5eff99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs
Expand Up @@ -463,8 +463,8 @@ public void Draw (ApplicationContext actx, SWM.DrawingContext dc, double scaleFa
// When an image is a single bitmap that doesn't have the same intrinsic size as the drawing size, dc.DrawImage makes a very poor job of down/up scaling it.
// Thus we handle this manually by using a TransformedBitmap to handle the conversion in a better way when it's needed.

var scaledWidth = idesc.Size.Height * scaleFactor;
var scaledHeight = idesc.Size.Width * scaleFactor;
var scaledWidth = idesc.Size.Width * scaleFactor;
var scaledHeight = idesc.Size.Height * scaleFactor;
if (bmpImage != null && (Math.Abs (bmpImage.PixelHeight - scaledHeight) > 0.001 || Math.Abs (bmpImage.PixelWidth - scaledWidth) > 0.001))
f = new TransformedBitmap (bmpImage, new ScaleTransform (scaledWidth / bmpImage.PixelWidth, scaledHeight / bmpImage.PixelHeight));

Expand Down

0 comments on commit c5eff99

Please sign in to comment.