Update Svg.Skia to SkiaSharp 4 preview#528
Draft
wieslawsoltes wants to merge 2 commits into
Draft
Conversation
6241b88 to
f05d1eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary: Update Svg.Skia to SkiaSharp 4 Preview
Summary
This PR updates the repository's SkiaSharp package set to the latest SkiaSharp 4 preview available
from NuGet, while keeping a practical source-level compatibility path for building the core renderer
against the previous SkiaSharp 3 package set.
The default central package configuration now uses:
SkiaSharpand related native/view packages:4.147.0-preview.2.1SkiaSharp.HarfBuzz:4.147.0-preview.2.1HarfBuzzSharpand native assets:8.3.1.6-preview.2.1Microsoft.Maui.Controlsand Compatibility:10.0.20The MAUI bump is required because
SkiaSharp.Views.Maui.Controls 4.147.0-preview.2.1depends onMicrosoft.Maui.Controls >= 10.0.20; keeping10.0.0causesNU1605downgrade failures in MAUIprojects.
What Changed
SkiaSharpVersionandHarfBuzzSharpVersionproperties inDirectory.Packages.props.$(SkiaSharpVersion).$(HarfBuzzSharpVersion).10.0.0to10.0.20.build/SkiaSharp.Avalonia.propsto override Avalonia SkiaSharp references through$(SkiaSharpVersion).v3 compatibility strategy.
Compatibility Notes
SkiaSharp 4 preview did not introduce compile errors in the solution. The migration impact is mostly
obsolete API usage:
SKPathmutation APIs now point towardSKPathBuilder.SKPaintAPIs now point towardSKFontand explicit text drawing overloads.SKPathMeasure.GetSegmentandSKPaint.GetFillPathnow preferSKPathBuilderoverloads.The current source still builds against SkiaSharp 3 by overriding the new version properties:
This keeps source compatibility feasible while the default package set moves forward to SkiaSharp 4
preview.
Validation
Ran:
Result:
0 Error(s)10577 Warning(s)Ran source compatibility check:
Result:
0 Error(s)356 Warning(s)Ran MAUI restore checks with
net10.0-maccatalystfor:src/Svg.Controls.Skia.Maui/Svg.Controls.Skia.Maui.csprojsrc/SvgML.Maui/SvgML.Maui.csprojsamples/MauiSvgSkiaSample/MauiSvgSkiaSample.csprojsamples/SvgML.Maui.Demo/SvgML.Maui.Demo.csprojResult: all restored successfully after the MAUI
10.0.20update.Ran:
dotnet test Svg.Skia.slnx -c Release --no-buildResult:
Avalonia.Skiais being forced onto SkiaSharp 4before Avalonia has aligned its runtime assumptions.
text-fonts-01-t: image error0.024473930618178694vs threshold0.022text-fonts-02-t: image error0.031028349414410593vs threshold0.022Performance Notes
Ran the existing
--profile-svgbenchmark profiler for the two largest sample/demo SVGs:samples/MauiSvgSkiaSample/Assets/__AJ_Digital_Camera.svgsamples/MauiSvgSkiaSample/Assets/__tiger.svgHigh-level result:
SKSvg.FromSvgand retained mutation rebuild,but slower for native picture creation, bitmap render, PNG encode, and full document rebuild.
creation, bitmap render, full load paths, and mutation rebuilds.
rather than allocation-driven.
Detailed benchmark numbers are included in
plan/skiasharp-3-vs-4-large-svg-benchmarks.md.Risks
SKPathBuilder/SKFontwould reduce warnings but requires aclear decision on whether source generation must continue supporting SkiaSharp 3.
Follow-Up
variants are needed.
SKPathBuilder/SKFontmigration plan after the v3 support boundary isdecided.