Update SkiaSharp adapter to non-obsolete DrawBitmap overloads#2580
Conversation
|
@copilot Your fix cannot work if you do not also migrate the Skia packages to the latest major version. The code you committed does not actually compile. |
raffaeler
left a comment
There was a problem hiding this comment.
The code you committed requires Skia V4
Addressed in |
|
@pgrawehr The changes are minimal. I would merge them. What do you think? |
There was a problem hiding this comment.
Pull request overview
Updates the SkiaSharp adapter to use SkiaSharp v4-supported SKCanvas.DrawBitmap overloads (with SKSamplingOptions) so the adapter can move off obsolete APIs and unblock a SkiaSharp package upgrade.
Changes:
- Upgraded SkiaSharp and
SkiaSharp.NativeAssets.Linuxpackage references to4.148.0for the adapter projects. - Replaced obsolete
DrawBitmapoverload usages withSKSamplingOptions-based overloads, usingSKSamplingOptions.Defaultto preserve existing behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Iot.Device.Bindings.SkiaSharpAdapter/Iot.Device.Bindings.SkiaSharpAdapter.csproj | Bumps SkiaSharp dependencies for the packable adapter package. |
| src/devices/SkiaSharpAdapter/SkiaSharpGraphicsExtensions.cs | Updates DrawBitmap calls to non-obsolete SKSamplingOptions overloads. |
| src/devices/SkiaSharpAdapter/SkiaSharpAdapter.csproj | Bumps SkiaSharp dependencies for the device-level adapter project. |
| <ProjectReference Include="..\Iot.Device.Bindings\Iot.Device.Bindings.csproj" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" /> | ||
| <PackageReference Include="SkiaSharp" Version="3.119.2" /> | ||
| <PackageReference Include="SkiaSharp" Version="4.148.0" /> | ||
| <!-- The NativeAssets packages for Windows and MacOS are included in the above by default --> | ||
| <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.2" /> | ||
| <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="4.148.0" /> | ||
| <Content Include="$(RepoRoot)src/devices/README-nuget.md" Pack="true" Visible="false" PackagePath="\README.md" /> |
I will do a verification hopefully soonish. |
SkiaSharp v4 obsoletes the
SKCanvas.DrawBitmapoverloads used by the SkiaSharp adapter, which blocks upgrading the package. This change switches the adapter to the supportedSKSamplingOptions-based overloads.What changed
DrawBitmapcalls with the corresponding overloads that acceptSKSamplingOptions.DrawBitmapcalls to the non-obsolete overloads as well.SKSamplingOptions.Defaultto preserve the existing rendering behavior as closely as possible.Affected paths
src/devices/SkiaSharpAdapter/SkiaSharpGraphicsExtensions.csExample
Scope
DrawBitmapusages in the SkiaSharp adapter, not just thefloat, floatoverload that surfaced first during compilation.