-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[12.0] Target SkiaSharp 3.0. Drop 2.88 support #18981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
public static SKSamplingOptions ToSKSamplingOptions(this BitmapInterpolationMode interpolationMode) | ||
{ | ||
switch (interpolationMode) | ||
return interpolationMode switch | ||
{ | ||
case BitmapInterpolationMode.Unspecified: | ||
case BitmapInterpolationMode.LowQuality: | ||
return SKFilterQuality.Low; | ||
case BitmapInterpolationMode.MediumQuality: | ||
return SKFilterQuality.Medium; | ||
case BitmapInterpolationMode.HighQuality: | ||
return SKFilterQuality.High; | ||
case BitmapInterpolationMode.None: | ||
return SKFilterQuality.None; | ||
default: | ||
throw new ArgumentOutOfRangeException(nameof(interpolationMode), interpolationMode, null); | ||
} | ||
BitmapInterpolationMode.None => | ||
new SKSamplingOptions(SKFilterMode.Nearest, SKMipmapMode.None), | ||
BitmapInterpolationMode.Unspecified or BitmapInterpolationMode.LowQuality => | ||
new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.None), | ||
BitmapInterpolationMode.MediumQuality => | ||
new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.Linear), | ||
BitmapInterpolationMode.HighQuality => | ||
new SKSamplingOptions(SKCubicResampler.Mitchell), | ||
_ => throw new ArgumentOutOfRangeException(nameof(interpolationMode), interpolationMode, null) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this #18677 |
@maxkatz6 This PR doesn't work with iOS right now, https://gist.github.com/drasticactions/e964b2445a55752b8618dc89359fc338 MetalPlatformGraphics.TryCreate e. I think I figured it out. The code in that TryCreate method that calls If you replace that method with public static MetalPlatformGraphics? TryCreate()
{
var device = MTLDevice.SystemDefault;
return device is null ? null : new MetalPlatformGraphics(device);
} It works. ![]() e2. Adding my change and re-adding Catalyst TFM as a target, Catalyst also works (Although some input stuff would need to be looked at, like scroll wheels for the list didn't work.) Catalyst.mp4 |
The iOS crash is a double dispose bug in SkiaSharp. |
IIRC, this extra metal context was used to validate whether metal is working fine, or fallback to opengl otherwise. These were issues in 2.88 where it could return null (I think maccatalyst or tvos related?). Either way, it should be removed now. Upd: yep, I even left a comment there for the future me: Avalonia/src/iOS/Avalonia.iOS/Metal/MetalPlatformGraphics.cs Lines 41 to 42 in 88bfecb
Definitely should remove it now. |
With 7f1a4d1, it fixes the iOS/Catalyst SkiaSharp 3.x issue and I can use it there, For #19028, I bumped my repro and the users repro to this version (on a different machine than what I originally had), built and ran it, and it worked. IMO we need more confirmation from them to make sure it works right on macOS 26 (since I was able to somehow get it working with no changes after originally get the same crash, and I'm not sure how I did that yet). But the changes to the bindings didn't regress it so I think it's safe in that context. |
What does the pull request do?
For the last year, 11.x builds were compatible with both 2.88 and 3.0 SkiaSharp versions.
Half a year ago, SkiaSharp 3.0 had first stable release.
And now it's time to drop 2.88 support on the Avalonia side.
Note, this PR is not going to be backported to 11.x versions.
How was the solution implemented (if it's not obvious)?
Breaking changes
Any app or dependency that uses SkiaSharp APIs that are not binary compatible with SkiaSharp 3.0 will break.
It should not affect majority of applications. And even with Skia dependent controls like LiveCharts2 are already compatible with SkiaSharp3.
Fixed issues
Closes #15503
Fixes #17735
Fixes #18677