diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 55bf1bbec..26a8b48df 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -525,8 +525,8 @@ namespace SixLabors.ImageSharp.Formats.Png int dpmX = (int)Math.Round(image.MetaData.HorizontalResolution * 39.3700787D); int dpmY = (int)Math.Round(image.MetaData.VerticalResolution * 39.3700787D); - BinaryPrimitives.WriteInt32BigEndian(this.chunkDataBuffer.AsSpan().Slice(0, 4), dpmX); - BinaryPrimitives.WriteInt32BigEndian(this.chunkDataBuffer.AsSpan().Slice(4, 4), dpmY); + BinaryPrimitives.WriteInt32BigEndian(new Span(this.chunkDataBuffer, 0, 4), dpmX); + BinaryPrimitives.WriteInt32BigEndian(new Span(this.chunkDataBuffer, 4, 4), dpmY); this.chunkDataBuffer[8] = 1; diff --git a/src/ImageSharp/Memory/BasicArrayBuffer.cs b/src/ImageSharp/Memory/BasicArrayBuffer.cs index 30ca210ac..a4810d037 100644 --- a/src/ImageSharp/Memory/BasicArrayBuffer.cs +++ b/src/ImageSharp/Memory/BasicArrayBuffer.cs @@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.Memory public int Length { get; } - public Span Span => this.Array.AsSpan().Slice(0, this.Length); + public Span Span => new Span(this.Array, 0, this.Length); /// /// Returns a reference to specified element of the buffer.