diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index 61ffcc6cc..83e0a8b08 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -26,7 +26,6 @@ public struct OctreeQuantizer : IQuantizer private readonly int maxColors; private readonly int bitDepth; private readonly Octree octree; - [NotNull] private IMemoryOwner? paletteOwner; private ReadOnlyMemory palette; private EuclideanPixelMap? pixelMap; @@ -99,7 +98,7 @@ public struct OctreeQuantizer : IQuantizer } int paletteIndex = 0; - Span paletteSpan = this.paletteOwner.GetSpan(); + Span paletteSpan = this.paletteOwner!.GetSpan(); // On very rare occasions, (blur.png), the quantizer does not preserve a // transparent entry when palletizing the captured colors. @@ -113,7 +112,7 @@ public struct OctreeQuantizer : IQuantizer } this.octree.Palletize(paletteSpan, max, ref paletteIndex); - ReadOnlyMemory result = this.paletteOwner.Memory[..paletteSpan.Length]; + ReadOnlyMemory result = this.paletteOwner!.Memory[..paletteSpan.Length]; // When called multiple times by QuantizerUtilities.BuildPalette // this prevents memory churn caused by reallocation. diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs index f8f9658a8..e73c87896 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs @@ -20,7 +20,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization; internal struct PaletteQuantizer : IQuantizer where TPixel : unmanaged, IPixel { - [NotNull] private EuclideanPixelMap? pixelMap; /// @@ -47,7 +46,7 @@ internal struct PaletteQuantizer : IQuantizer public QuantizerOptions Options { get; } /// - public ReadOnlyMemory Palette => this.pixelMap.Palette; + public ReadOnlyMemory Palette => this.pixelMap!.Palette; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -63,7 +62,7 @@ internal struct PaletteQuantizer : IQuantizer /// [MethodImpl(InliningOptions.ShortMethod)] public readonly byte GetQuantizedColor(TPixel color, out TPixel match) - => (byte)this.pixelMap.GetClosestColor(color, out match); + => (byte)this.pixelMap!.GetClosestColor(color, out match); /// public void Dispose()