Skip to content

Commit c6e5839

Browse files
Minor cleanup
1 parent 9c9ebb2 commit c6e5839

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/ImageSharp/Formats/Gif/GifDecoderCore.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ private void ReadApplicationExtension(BufferedReadStream stream)
337337

338338
/// <summary>
339339
/// Skips over a block or reads its terminator.
340-
/// <param name="blockSize">The length of the block to skip.</param>
341-
/// <param name="stream">The <see cref="BufferedReadStream"/> containing image data.</param>
342340
/// </summary>
341+
/// <param name="stream">The <see cref="BufferedReadStream"/> containing image data.</param>
342+
/// <param name="blockSize">The length of the block to skip.</param>
343343
private static void SkipBlock(BufferedReadStream stream, int blockSize = 0)
344344
{
345345
if (blockSize > 0)
@@ -363,7 +363,7 @@ private void ReadComments(BufferedReadStream stream)
363363
{
364364
int length;
365365

366-
StringBuilder stringBuilder = new StringBuilder();
366+
StringBuilder stringBuilder = new();
367367
while ((length = stream.ReadByte()) != 0)
368368
{
369369
if (length > GifConstants.MaxCommentSubBlockLength)
@@ -450,7 +450,7 @@ private void ReadFrame<TPixel>(BufferedReadStream stream, ref Image<TPixel>? ima
450450
private void ReadFrameIndices(BufferedReadStream stream, Buffer2D<byte> indices)
451451
{
452452
int minCodeSize = stream.ReadByte();
453-
using LzwDecoder lzwDecoder = new LzwDecoder(this.configuration.MemoryAllocator, stream);
453+
using LzwDecoder lzwDecoder = new(this.configuration.MemoryAllocator, stream);
454454
lzwDecoder.DecodePixels(minCodeSize, indices);
455455
}
456456

src/ImageSharp/Formats/Gif/GifEncoderCore.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Six Labors Split License.
33

44
using System.Buffers;
5-
using System.Diagnostics.CodeAnalysis;
65
using System.Runtime.CompilerServices;
76
using System.Runtime.InteropServices;
87
using SixLabors.ImageSharp.Advanced;
@@ -141,7 +140,7 @@ public void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken
141140
private void EncodeFrames<TPixel>(
142141
Stream stream,
143142
Image<TPixel> image,
144-
IndexedImageFrame<TPixel>? quantized,
143+
IndexedImageFrame<TPixel> quantized,
145144
ReadOnlyMemory<TPixel> palette)
146145
where TPixel : unmanaged, IPixel<TPixel>
147146
{
@@ -168,7 +167,6 @@ private void EncodeFrames<TPixel>(
168167

169168
// Clean up for the next run.
170169
quantized.Dispose();
171-
quantized = null;
172170
}
173171

174172
if (hasPaletteQuantizer)

src/ImageSharp/Image.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public abstract partial class Image : ImageInfo, IDisposable, IConfigurationProv
3030
/// <param name="size">The size in px units.</param>
3131
protected Image(Configuration configuration, PixelTypeInfo pixelType, ImageMetadata? metadata, Size size)
3232
: base(pixelType, size, metadata)
33-
=> this.configuration = configuration ?? Configuration.Default;
33+
=> this.configuration = configuration;
3434

3535
/// <summary>
3636
/// Initializes a new instance of the <see cref="Image"/> class.

0 commit comments

Comments
 (0)