|
|
@ -16,11 +16,15 @@ namespace Avalonia.iOS |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
class EmulatedFramebuffer : ILockedFramebuffer |
|
|
class EmulatedFramebuffer : ILockedFramebuffer |
|
|
{ |
|
|
{ |
|
|
|
|
|
private nfloat _viewWidth; |
|
|
|
|
|
private nfloat _viewHeight; |
|
|
|
|
|
|
|
|
public EmulatedFramebuffer(UIView view) |
|
|
public EmulatedFramebuffer(UIView view) |
|
|
{ |
|
|
{ |
|
|
var factor = (int) UIScreen.MainScreen.Scale; |
|
|
var factor = (int) UIScreen.MainScreen.Scale; |
|
|
var frame = view.Frame; |
|
|
var frame = view.Frame; |
|
|
|
|
|
_viewWidth = frame.Width; |
|
|
|
|
|
_viewHeight = frame.Height; |
|
|
Width = (int) frame.Width * factor; |
|
|
Width = (int) frame.Width * factor; |
|
|
Height = (int) frame.Height * factor; |
|
|
Height = (int) frame.Height * factor; |
|
|
RowBytes = Width * 4; |
|
|
RowBytes = Width * 4; |
|
|
@ -41,9 +45,9 @@ namespace Avalonia.iOS |
|
|
using (var context = UIGraphics.GetCurrentContext()) |
|
|
using (var context = UIGraphics.GetCurrentContext()) |
|
|
{ |
|
|
{ |
|
|
// flip the image for CGContext.DrawImage
|
|
|
// flip the image for CGContext.DrawImage
|
|
|
context.TranslateCTM(0, Height); |
|
|
context.TranslateCTM(0, _viewHeight); |
|
|
context.ScaleCTM(1, -1); |
|
|
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); |
|
|
Marshal.FreeHGlobal(Address); |
|
|
Address = IntPtr.Zero; |
|
|
Address = IntPtr.Zero; |
|
|
@ -57,3 +61,4 @@ namespace Avalonia.iOS |
|
|
public PixelFormat Format { get; } |
|
|
public PixelFormat Format { get; } |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|