Browse Source

Fixed iOS

ios-fix
Nikita Tsukanov 8 years ago
parent
commit
604700e9e7
  1. 1
      build/Rx.props
  2. 5
      samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj
  3. 9
      src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs

1
build/Rx.props

@ -5,6 +5,5 @@
<PackageReference Include="System.Reactive.Interfaces" Version="3.1.1" />
<PackageReference Include="System.Reactive.Linq" Version="3.1.1" />
<PackageReference Include="System.Reactive.PlatformServices" Version="3.1.1" />
<PackageReference Condition="$(TargetFramework.StartsWith('net4'))" Include="System.Reactive.Windows.Threading" Version="3.1.1" />
</ItemGroup>
</Project>

5
samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj

@ -170,15 +170,14 @@
<Name>Avalonia.Themes.Default</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj">
<Project>{D2D3083-71DD-4CC9-8907-39A0D86FB322}</Project>
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project>
<Name>Avalonia.Skia</Name>
<IsAppExtension>false</IsAppExtension>
<IsWatchApp>false</IsWatchApp>
</ProjectReference>
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj">
<Project>{d0a739b9-3c68-4ba6-a328-41606954b6bd}</Project>
<Name>ControlCatalog</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\..\build\Sprache.props" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

9
src/iOS/Avalonia.iOS/EmulatedFramebuffer.cs

@ -16,11 +16,15 @@ namespace Avalonia.iOS
/// </summary>
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; }
}
}

Loading…
Cancel
Save