@@ -26,7 +26,7 @@ public struct OctreeQuantizer<TPixel> : IQuantizer<TPixel>
26
26
private readonly int maxColors ;
27
27
private readonly int bitDepth ;
28
28
private readonly Octree octree ;
29
- private IMemoryOwner < TPixel > ? paletteOwner ;
29
+ private IMemoryOwner < TPixel > paletteOwner ;
30
30
private ReadOnlyMemory < TPixel > palette ;
31
31
private EuclideanPixelMap < TPixel > ? pixelMap ;
32
32
private readonly bool isDithering ;
@@ -98,7 +98,7 @@ public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
98
98
}
99
99
100
100
int paletteIndex = 0 ;
101
- Span < TPixel > paletteSpan = this . paletteOwner ! . GetSpan ( ) ;
101
+ Span < TPixel > paletteSpan = this . paletteOwner . GetSpan ( ) ;
102
102
103
103
// On very rare occasions, (blur.png), the quantizer does not preserve a
104
104
// transparent entry when palletizing the captured colors.
@@ -112,7 +112,7 @@ public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
112
112
}
113
113
114
114
this . octree . Palletize ( paletteSpan , max , ref paletteIndex ) ;
115
- ReadOnlyMemory < TPixel > result = this . paletteOwner ! . Memory [ ..paletteSpan . Length ] ;
115
+ ReadOnlyMemory < TPixel > result = this . paletteOwner . Memory [ ..paletteSpan . Length ] ;
116
116
117
117
// When called multiple times by QuantizerUtilities.BuildPalette
118
118
// this prevents memory churn caused by reallocation.
@@ -157,8 +157,7 @@ public void Dispose()
157
157
if ( ! this . isDisposed )
158
158
{
159
159
this . isDisposed = true ;
160
- this . paletteOwner ? . Dispose ( ) ;
161
- this . paletteOwner = null ;
160
+ this . paletteOwner . Dispose ( ) ;
162
161
this . pixelMap ? . Dispose ( ) ;
163
162
this . pixelMap = null ;
164
163
}
0 commit comments