From 604700e9e795130354d13b3af7dc421c58a9702e Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Mon, 26 Feb 2018 20:01:39 +0300 Subject: [PATCH] Fixed iOS --- build/Rx.props | 1 - samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj | 5 ++--- src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs | 9 +++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build/Rx.props b/build/Rx.props index 323026f5e2..7078e31195 100644 --- a/build/Rx.props +++ b/build/Rx.props @@ -5,6 +5,5 @@ - diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj index 77f38d3bd7..c1c5cdcaf7 100644 --- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj +++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj @@ -170,15 +170,14 @@ Avalonia.Themes.Default - {D2D3083-71DD-4CC9-8907-39A0D86FB322} + {7d2d3083-71dd-4cc9-8907-39a0d86fb322} Avalonia.Skia - false - false {d0a739b9-3c68-4ba6-a328-41606954b6bd} ControlCatalog + \ No newline at end of file diff --git a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs index 58cf6edd78..517b372ba4 100644 --- a/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs +++ b/src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs @@ -16,11 +16,15 @@ namespace Avalonia.iOS /// class EmulatedFramebuffer : ILockedFramebuffer { + private nfloat _viewWidth; + private nfloat _viewHeight; public EmulatedFramebuffer(UIView view) { var factor = (int) UIScreen.MainScreen.Scale; var frame = view.Frame; + _viewWidth = frame.Width; + _viewHeight = frame.Height; Width = (int) frame.Width * factor; Height = (int) frame.Height * factor; RowBytes = Width * 4; @@ -41,9 +45,9 @@ namespace Avalonia.iOS using (var context = UIGraphics.GetCurrentContext()) { // flip the image for CGContext.DrawImage - context.TranslateCTM(0, Height); + context.TranslateCTM(0, _viewHeight); context.ScaleCTM(1, -1); - context.DrawImage(new CGRect(0, 0, Width, Height), image); + context.DrawImage(new CGRect(0, 0, _viewWidth, _viewHeight), image); } Marshal.FreeHGlobal(Address); Address = IntPtr.Zero; @@ -57,3 +61,4 @@ namespace Avalonia.iOS public PixelFormat Format { get; } } } +