Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="darc-pub-dotnet-runtime-3ba4b3f" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-3ba4b3f4/nuget/v3/index.json" />
<add key="darc-pub-dotnet-emsdk-ee0a97a" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-ee0a97a0/nuget/v3/index.json" />
</packageSources>
</configuration>
9 changes: 5 additions & 4 deletions scripts/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ variables:
MONO_VERSION_MACOS: '6_12_7'
MONO_VERSION_LINUX: ''
XCODE_VERSION: 12.4
DOTNET_VERSION_PREVIOUS: 3.1.413
DOTNET_VERSION: 6.0.200
DOTNET_VERSION_PREVIEW: ''
DOTNET_WORKLOAD_SOURCE: 'https://aka.ms/dotnet/maui/6.0.200/preview.13.json'
DOTNET_VERSION_PREVIOUS: 3.1.416
DOTNET_VERSION: 5.0.405
DOTNET_VERSION_PREVIEW: '6.0.200-rtm.22107.3'
DOTNET_WORKLOAD_SOURCE: 'https://aka.ms/dotnet/maui/6.0.200/preview.14.json'
VS_VERSION_PREVIEW: 17/pre
CONFIGURATION: 'Release'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
THROW_ON_TEST_FAILURE: true
Expand Down
8 changes: 7 additions & 1 deletion scripts/install-dotnet-workloads.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ $ErrorActionPreference = 'Stop'
$env:DOTNET_ROOT="$InstallDir"

$previewFeed = 'https://api.nuget.org/v3/index.json'
$previewRuntime = 'https://api.nuget.org/v3/index.json'
$previewEmscripten = 'https://api.nuget.org/v3/index.json'
if ($IsPreview) {
$previewFeed = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json'
$previewRuntime = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-6dd808ff-1/nuget/v3/index.json'
$previewEmscripten = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-ee0a97a0/nuget/v3/index.json'
}

Write-Host "Installing workloads..."
& dotnet workload install `
android ios tvos macos maccatalyst wasm-tools maui `
--from-rollback-file $SourceUrl `
--source https://api.nuget.org/v3/index.json `
--source $previewFeed
--source $previewFeed `
--source $previewRuntime `
--source $previewEmscripten

exit $LASTEXITCODE
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected override void SetupRenderLoop(bool oneShot)
// redraw the view
nativeView.Display();
});
displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode);
displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Default);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@ public partial class SKCanvasViewHandler : ViewHandler<ISKCanvasView, SKCanvasVi
private SKSizeI lastCanvasSize;
private SKTouchHandler? touchHandler;

protected override SKCanvasView CreateNativeView() => new SKCanvasView(Context);
protected override SKCanvasView CreatePlatformView() => new SKCanvasView(Context);

protected override void ConnectHandler(SKCanvasView nativeView)
protected override void ConnectHandler(SKCanvasView platformView)
{
nativeView.PaintSurface += OnPaintSurface;
platformView.PaintSurface += OnPaintSurface;

base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);
}

protected override void DisconnectHandler(SKCanvasView nativeView)
protected override void DisconnectHandler(SKCanvasView platformView)
{
touchHandler?.Detach(nativeView);
touchHandler?.Detach(platformView);
touchHandler = null;

nativeView.PaintSurface -= OnPaintSurface;
platformView.PaintSurface -= OnPaintSurface;

base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);
}

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.Invalidate();
handler.PlatformView?.Invalidate();
}

public static void MapIgnorePixelScaling(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
handler.NativeView?.UpdateIgnorePixelScaling(canvasView);
handler.PlatformView?.UpdateIgnorePixelScaling(canvasView);
}

public static void MapEnableTouchEvents(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
if (handler.NativeView == null)
if (handler.PlatformView == null)
return;

handler.touchHandler ??= new SKTouchHandler(
args => canvasView.OnTouch(args),
(x, y) => handler.OnGetScaledCoord(x, y));

handler.touchHandler?.SetEnabled(handler.NativeView, canvasView.EnableTouchEvents);
handler.touchHandler?.SetEnabled(handler.PlatformView, canvasView.EnableTouchEvents);
}

// helper methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace SkiaSharp.Views.Maui.Handlers
{
public partial class SKCanvasViewHandler : ViewHandler<ISKCanvasView, object>
{
protected override object CreateNativeView() => throw new NotImplementedException();
protected override object CreatePlatformView() => throw new NotImplementedException();

public static void MapIgnorePixelScaling(SKCanvasViewHandler handler, ISKCanvasView canvasView) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,47 @@ public partial class SKCanvasViewHandler : ViewHandler<ISKCanvasView, SKXamlCanv
private SKSizeI lastCanvasSize;
private SKTouchHandler? touchHandler;

protected override SKXamlCanvas CreateNativeView() => new SKXamlCanvas();
protected override SKXamlCanvas CreatePlatformView() => new SKXamlCanvas();

protected override void ConnectHandler(SKXamlCanvas nativeView)
protected override void ConnectHandler(SKXamlCanvas platformView)
{
nativeView.PaintSurface += OnPaintSurface;
platformView.PaintSurface += OnPaintSurface;

base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);
}

protected override void DisconnectHandler(SKXamlCanvas nativeView)
protected override void DisconnectHandler(SKXamlCanvas platformView)
{
touchHandler?.Detach(nativeView);
touchHandler?.Detach(platformView);
touchHandler = null;

nativeView.PaintSurface -= OnPaintSurface;
platformView.PaintSurface -= OnPaintSurface;

base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);
}

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.Invalidate();
handler.PlatformView?.Invalidate();
}

public static void MapIgnorePixelScaling(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
handler.NativeView?.UpdateIgnorePixelScaling(canvasView);
handler.PlatformView?.UpdateIgnorePixelScaling(canvasView);
}

public static void MapEnableTouchEvents(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
if (handler.NativeView == null)
if (handler.PlatformView == null)
return;

handler.touchHandler ??= new SKTouchHandler(
args => canvasView.OnTouch(args),
(x, y) => handler.OnGetScaledCoord(x, y));

handler.touchHandler?.SetEnabled(handler.NativeView, canvasView.EnableTouchEvents);
handler.touchHandler?.SetEnabled(handler.PlatformView, canvasView.EnableTouchEvents);
}

// helper methods
Expand All @@ -68,9 +68,9 @@ private void OnPaintSurface(object? sender, Windows.SKPaintSurfaceEventArgs e)

private SKPoint OnGetScaledCoord(double x, double y)
{
if (VirtualView?.IgnorePixelScaling == false && NativeView != null)
if (VirtualView?.IgnorePixelScaling == false && PlatformView != null)
{
var scale = NativeView.Dpi;
var scale = PlatformView.Dpi;

x *= scale;
y *= scale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,47 @@ public partial class SKCanvasViewHandler : ViewHandler<ISKCanvasView, SKCanvasVi
private SKSizeI lastCanvasSize;
private SKTouchHandler? touchHandler;

protected override SKCanvasView CreateNativeView() => new SKCanvasView { BackgroundColor = UIColor.Clear };
protected override SKCanvasView CreatePlatformView() => new SKCanvasView { BackgroundColor = UIColor.Clear };

protected override void ConnectHandler(SKCanvasView nativeView)
protected override void ConnectHandler(SKCanvasView platformView)
{
nativeView.PaintSurface += OnPaintSurface;
platformView.PaintSurface += OnPaintSurface;

base.ConnectHandler(nativeView);
base.ConnectHandler(platformView);
}

protected override void DisconnectHandler(SKCanvasView nativeView)
protected override void DisconnectHandler(SKCanvasView platformView)
{
touchHandler?.Detach(nativeView);
touchHandler?.Detach(platformView);
touchHandler = null;

nativeView.PaintSurface -= OnPaintSurface;
platformView.PaintSurface -= OnPaintSurface;

base.DisconnectHandler(nativeView);
base.DisconnectHandler(platformView);
}

// Mapper actions / properties

public static void OnInvalidateSurface(SKCanvasViewHandler handler, ISKCanvasView canvasView, object? args)
{
handler.NativeView?.SetNeedsDisplay();
handler.PlatformView?.SetNeedsDisplay();
}

public static void MapIgnorePixelScaling(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
handler.NativeView?.UpdateIgnorePixelScaling(canvasView);
handler.PlatformView?.UpdateIgnorePixelScaling(canvasView);
}

public static void MapEnableTouchEvents(SKCanvasViewHandler handler, ISKCanvasView canvasView)
{
if (handler.NativeView == null)
if (handler.PlatformView == null)
return;

handler.touchHandler ??= new SKTouchHandler(
args => canvasView.OnTouch(args),
(x, y) => handler.OnGetScaledCoord(x, y));

handler.touchHandler?.SetEnabled(handler.NativeView, canvasView.EnableTouchEvents);
handler.touchHandler?.SetEnabled(handler.PlatformView, canvasView.EnableTouchEvents);
}

// helper methods
Expand All @@ -69,9 +69,9 @@ private void OnPaintSurface(object? sender, iOS.SKPaintSurfaceEventArgs e)

private SKPoint OnGetScaledCoord(double x, double y)
{
if (VirtualView?.IgnorePixelScaling == false && NativeView != null)
if (VirtualView?.IgnorePixelScaling == false && PlatformView != null)
{
var scale = NativeView.ContentScaleFactor;
var scale = PlatformView.ContentScaleFactor;

x *= scale;
y *= scale;
Expand Down