Skip to content

Commit

Permalink
Update to 11.0.0-preview1
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Aug 19, 2022
1 parent abb1c45 commit 20c9158
Show file tree
Hide file tree
Showing 40 changed files with 123 additions and 80 deletions.
1 change: 1 addition & 0 deletions Svg.Skia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "props", "props", "{5BFEF4F8
build\XUnit.props = build\XUnit.props
build\SourceLink.props = build\SourceLink.props
build\Avalonia.Web.Blazor.props = build\Avalonia.Web.Blazor.props
build\Avalonia.Themes.Fluent.props = build\Avalonia.Themes.Fluent.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7863AE7D-FF68-45BF-BA68-6FA0E5604CB7}"
Expand Down
2 changes: 1 addition & 1 deletion build/Avalonia.Desktop.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.16" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.Diagnostics.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.16" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.ReactiveUI.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.16" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.Skia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Skia" Version="0.10.16" />
<PackageReference Include="Avalonia.Skia" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions build/Avalonia.Themes.Fluent.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.Web.Blazor.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Web.Blazor" Version="0.10.16" />
<PackageReference Include="Avalonia.Web.Blazor" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.16" />
<PackageReference Include="Avalonia" Version="11.0.0-preview1" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions build/Base.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>0.5.16</VersionPrefix>
<VersionSuffix></VersionSuffix>
<AvaloniaVersionPrefix>0.10.16</AvaloniaVersionPrefix>
<VersionPrefix>0.6.0</VersionPrefix>
<VersionSuffix>preview1</VersionSuffix>
<AvaloniaVersionPrefix>11.0.0</AvaloniaVersionPrefix>
<AvaloniaVersionSuffix>$(VersionSuffix)</AvaloniaVersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
Expand Down
2 changes: 1 addition & 1 deletion build/SkiaSharp.HarfBuzz.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.1-preview.1" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.1-preview.108" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/SkiaSharp.Linux.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.108" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/SkiaSharp.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.1" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<Import Project="..\..\build\Avalonia.props" />
<Import Project="..\..\build\Avalonia.Themes.Fluent.props" />
<Import Project="..\..\build\Avalonia.Desktop.props" />
<Import Project="..\..\build\Avalonia.Diagnostics.props" />

Expand Down
1 change: 1 addition & 0 deletions samples/AvaloniaSvgSample/AvaloniaSvgSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<Import Project="..\..\build\Avalonia.props" />
<Import Project="..\..\build\Avalonia.Themes.Fluent.props" />
<Import Project="..\..\build\Avalonia.Desktop.props" />
<Import Project="..\..\build\Avalonia.Diagnostics.props" />

Expand Down
1 change: 1 addition & 0 deletions samples/AvaloniaSvgSkiaSample/AvaloniaSvgSkiaSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</ItemGroup>

<Import Project="..\..\build\Avalonia.props" />
<Import Project="..\..\build\Avalonia.Themes.Fluent.props" />
<Import Project="..\..\build\Avalonia.Desktop.props" />
<Import Project="..\..\build\Avalonia.Diagnostics.props" />

Expand Down
2 changes: 1 addition & 1 deletion samples/TestApp.Base/TestApp.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<Import Project="..\..\build\ReferenceAssemblies.props" />
<Import Project="..\..\build\Avalonia.props" />
<Import Project="..\..\build\Avalonia.Desktop.props" />
<Import Project="..\..\build\Avalonia.Themes.Fluent.props" />
<Import Project="..\..\build\Avalonia.Diagnostics.props" />
<Import Project="..\..\build\Avalonia.ReactiveUI.props" />
<Import Project="..\..\build\SkiaSharp.props" />
Expand Down
10 changes: 5 additions & 5 deletions samples/TestApp.Base/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class ViewLocator : IDataTemplate
{
public bool SupportsRecycling => false;

public IControl Build(object data)
public IControl Build(object? data)
{
var name = data.GetType().FullName!.Replace("ViewModel", "View");
var type = Type.GetType(name);
var name = data?.GetType().FullName?.Replace("ViewModel", "View");
var type = name is null ? null : Type.GetType(name);

if (type != null)
{
Expand All @@ -24,8 +24,8 @@ public IControl Build(object data)
}
}

public bool Match(object data)
public bool Match(object? data)
{
return data is ViewModelBase;
}
}
}
2 changes: 1 addition & 1 deletion samples/TestApp.Base/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void Drop(object? sender, DragEventArgs e)
}
}

private void FileItem_OnDoubleTapped(object? sender, RoutedEventArgs e)
private void FileItem_OnDoubleTapped(object? sender, TappedEventArgs e)
{
if (sender is Control control && control.DataContext is FileItemViewModel fileItemViewModel)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Controls.Skia/SKBitmapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public override void Render(DrawingContext context)
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);

Expand Down
10 changes: 8 additions & 2 deletions src/Avalonia.Controls.Skia/SKBitmapDrawOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public void Dispose()

public void Render(IDrawingContextImpl context)
{
var canvas = (context as ISkiaDrawingContextImpl)?.SkCanvas;
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature is null)
{
return;
}
using var lease = leaseFeature.Lease();
var canvas = lease?.SkCanvas;
if (canvas is { } && _bitmap is { })
{
canvas.DrawBitmap(
Expand All @@ -37,4 +43,4 @@ public void Render(IDrawingContextImpl context)
SKRect.Create((float)_bounds.Left, (float)_bounds.Top, (float)_bounds.Width, (float)_bounds.Height));
}
}
}
}
6 changes: 3 additions & 3 deletions src/Avalonia.Controls.Skia/SKBitmapImage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Metadata;
using Avalonia.Visuals.Media.Imaging;
using SkiaSharp;

namespace Avalonia.Controls.Skia;
Expand Down Expand Up @@ -55,7 +55,7 @@ void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect, BitmapI
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == SourceProperty)
Expand All @@ -69,4 +69,4 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
/// </summary>
/// <param name="e">The event args.</param>
protected void RaiseInvalidated(EventArgs e) => Invalidated?.Invoke(this, e);
}
}
4 changes: 2 additions & 2 deletions src/Avalonia.Controls.Skia/SKPathControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public override void Render(DrawingContext context)
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);

Expand All @@ -174,4 +174,4 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
/// </summary>
/// <param name="e">The event args.</param>
protected void RaiseInvalidated(EventArgs e) => Invalidated?.Invoke(this, e);
}
}
10 changes: 8 additions & 2 deletions src/Avalonia.Controls.Skia/SKPathDrawOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ public void Dispose()

public void Render(IDrawingContextImpl context)
{
var canvas = (context as ISkiaDrawingContextImpl)?.SkCanvas;
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature is null)
{
return;
}
using var lease = leaseFeature.Lease();
var canvas = lease?.SkCanvas;
if (canvas is null || _path is null)
{
return;
}

canvas.DrawPath(_path, _paint);
}
}
}
6 changes: 3 additions & 3 deletions src/Avalonia.Controls.Skia/SKPathImage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia.Media;
using Avalonia.Metadata;
using Avalonia.Visuals.Media.Imaging;
using Avalonia.Media.Imaging;
using SkiaSharp;

namespace Avalonia.Controls.Skia;
Expand Down Expand Up @@ -75,7 +75,7 @@ void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect, BitmapI
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == SourceProperty)
Expand All @@ -89,4 +89,4 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
/// </summary>
/// <param name="e">The event args.</param>
protected void RaiseInvalidated(EventArgs e) => Invalidated?.Invoke(this, e);
}
}
4 changes: 2 additions & 2 deletions src/Avalonia.Controls.Skia/SKPictureControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public override void Render(DrawingContext context)
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);

Expand All @@ -151,4 +151,4 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
/// </summary>
/// <param name="e">The event args.</param>
protected void RaiseInvalidated(EventArgs e) => Invalidated?.Invoke(this, e);
}
}
10 changes: 8 additions & 2 deletions src/Avalonia.Controls.Skia/SKPictureDrawOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public void Dispose()

public void Render(IDrawingContextImpl context)
{
var canvas = (context as ISkiaDrawingContextImpl)?.SkCanvas;
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature is null)
{
return;
}
using var lease = leaseFeature.Lease();
var canvas = lease?.SkCanvas;
if (canvas is null || _picture is null)
{
return;
Expand All @@ -38,4 +44,4 @@ public void Render(IDrawingContextImpl context)
canvas.DrawPicture(_picture);
canvas.Restore();
}
}
}
6 changes: 3 additions & 3 deletions src/Avalonia.Controls.Skia/SKPictureImage.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia.Media;
using Avalonia.Metadata;
using Avalonia.Visuals.Media.Imaging;
using Avalonia.Media.Imaging;
using SkiaSharp;

namespace Avalonia.Controls.Skia;
Expand Down Expand Up @@ -55,7 +55,7 @@ void IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect, BitmapI
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == SourceProperty)
Expand All @@ -69,4 +69,4 @@ protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T>
/// </summary>
/// <param name="e">The event args.</param>
protected void RaiseInvalidated(EventArgs e) => Invalidated?.Invoke(this, e);
}
}
6 changes: 3 additions & 3 deletions src/Avalonia.Svg.Skia/Svg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,20 @@ public override void Render(DrawingContext context)
}

/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);

if (change.Property == PathProperty)
{
var path = change.NewValue.GetValueOrDefault<string?>();
var path = change.GetNewValue<string?>();
Load(path);
RaiseInvalidated(EventArgs.Empty);
}

if (change.Property == EnableCacheProperty)
{
var enableCache = change.NewValue.GetValueOrDefault<bool>();
var enableCache = change.GetNewValue<bool>();
if (enableCache == false)
{
DisposeCache();
Expand Down
12 changes: 9 additions & 3 deletions src/Avalonia.Svg.Skia/SvgCustomDrawOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ public void Render(IDrawingContextImpl context)
{
return;
}

var canvas = (context as ISkiaDrawingContextImpl)?.SkCanvas;

var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature is null)
{
return;
}
using var lease = leaseFeature.Lease();
var canvas = lease?.SkCanvas;
if (canvas is null)
{
return;
Expand All @@ -42,4 +48,4 @@ public void Render(IDrawingContextImpl context)
canvas.DrawPicture(_svg.Picture);
canvas.Restore();
}
}
}
Loading

0 comments on commit 20c9158

Please sign in to comment.