diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2013-12-03 23:40:39 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2013-12-03 23:40:39 +0400 |
commit | d41c0f1b037311ebdffc4bda40aff82f5480548e (patch) | |
tree | d9346c10575b88ce67e784981f9f1094abde5768 /Xwt.WPF/Xwt.WPFBackend | |
parent | 23e5f5df221cf36cf8b2122c3a025b1c6482b1d1 (diff) |
[WPF] Fixed 9-patch rendering issues
And added tests.
Diffstat (limited to 'Xwt.WPF/Xwt.WPFBackend')
-rw-r--r-- | Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs b/Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs index d53af270..77e19601 100644 --- a/Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs +++ b/Xwt.WPF/Xwt.WPFBackend/ImageHandler.cs @@ -418,14 +418,16 @@ namespace Xwt.WPFBackend { ImageDescription idesc = new ImageDescription () { Alpha = 1, - Size = new Size (width * scaleFactor, height * scaleFactor) + Size = new Size (width, height) }; SWM.DrawingVisual visual = new SWM.DrawingVisual (); - using (SWM.DrawingContext ctx = visual.RenderOpen ()) { - Draw (actx, ctx, 1, 0, 0, idesc); + using (SWM.DrawingContext ctx = visual.RenderOpen ()) {
+ ctx.PushTransform (new ScaleTransform (scaleFactor, scaleFactor));
+ Draw (actx, ctx, scaleFactor, 0, 0, idesc);
+ ctx.Pop (); } - SWMI.RenderTargetBitmap bmp = new SWMI.RenderTargetBitmap ((int)idesc.Size.Width, (int)idesc.Size.Height, 96, 96, PixelFormats.Pbgra32); + SWMI.RenderTargetBitmap bmp = new SWMI.RenderTargetBitmap ((int)(width * scaleFactor), (int)(height * scaleFactor), 96, 96, PixelFormats.Pbgra32); bmp.Render (visual); var f = new ImageFrame (bmp, width, height); |