diff options
| author | Bond-009 <bond.009@outlook.com> | 2026-03-30 14:08:09 -0400 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2026-03-30 14:08:09 -0400 |
| commit | d5d4309417ff6d39015db57c729cf55111df8ac0 (patch) | |
| tree | 99033aeee5dce554ebda99c61f5ae7da1952b516 | |
| parent | 5b3537b3d7260fb0ab0694d68ddc03e5495f262d (diff) | |
Backport pull request #16522 from jellyfin/release-10.11.z
Fix CA1810 build error
Original-merge: 7e88b18192762dcbf82b2182bacd486b4d828e04
Merged-by: nielsvanvelzen <nielsvanvelzen@users.noreply.github.com>
Backported-by: Bond_009 <bond.009@outlook.com>
| -rw-r--r-- | src/Jellyfin.Drawing.Skia/SkiaEncoder.cs | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs index babab57d5..3f7ae4d2c 100644 --- a/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs +++ b/src/Jellyfin.Drawing.Skia/SkiaEncoder.cs @@ -24,44 +24,29 @@ public class SkiaEncoder : IImageEncoder private static readonly HashSet<string> _transparentImageTypes = new(StringComparer.OrdinalIgnoreCase) { ".png", ".gif", ".webp" }; private readonly ILogger<SkiaEncoder> _logger; private readonly IApplicationPaths _appPaths; - private static readonly SKImageFilter _imageFilter; private static readonly SKTypeface?[] _typefaces = InitializeTypefaces(); + private static readonly SKImageFilter _imageFilter = SKImageFilter.CreateMatrixConvolution( + new SKSizeI(3, 3), + [ + 0, -.1f, 0, + -.1f, 1.4f, -.1f, + 0, -.1f, 0 + ], + 1f, + 0f, + new SKPointI(1, 1), + SKShaderTileMode.Clamp, + true); /// <summary> /// The default sampling options, equivalent to old high quality filter settings when upscaling. /// </summary> - public static readonly SKSamplingOptions UpscaleSamplingOptions; + public static readonly SKSamplingOptions UpscaleSamplingOptions = new SKSamplingOptions(SKCubicResampler.Mitchell); /// <summary> /// The sampling options, used for downscaling images, equivalent to old high quality filter settings when not upscaling. /// </summary> - public static readonly SKSamplingOptions DefaultSamplingOptions; - - static SkiaEncoder() - { - var kernel = new[] - { - 0, -.1f, 0, - -.1f, 1.4f, -.1f, - 0, -.1f, 0, - }; - - var kernelSize = new SKSizeI(3, 3); - var kernelOffset = new SKPointI(1, 1); - _imageFilter = SKImageFilter.CreateMatrixConvolution( - kernelSize, - kernel, - 1f, - 0f, - kernelOffset, - SKShaderTileMode.Clamp, - true); - - // use cubic for upscaling - UpscaleSamplingOptions = new SKSamplingOptions(SKCubicResampler.Mitchell); - // use bilinear for everything else - DefaultSamplingOptions = new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.Linear); - } + public static readonly SKSamplingOptions DefaultSamplingOptions = new SKSamplingOptions(SKFilterMode.Linear, SKMipmapMode.Linear); /// <summary> /// Initializes a new instance of the <see cref="SkiaEncoder"/> class. |
