diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index dba4eaa15c..fbb5c29a47 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -3,6 +3,7 @@
using System;
using System.Buffers;
+using System.Buffers.Binary;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -414,14 +415,11 @@ namespace SixLabors.ImageSharp.Formats.Png
///
/// The metadata to read to.
/// The data containing physical data.
- private void ReadPhysicalChunk(ImageMetaData metadata, byte[] data)
+ private void ReadPhysicalChunk(ImageMetaData metadata, ReadOnlySpan data)
{
- data.ReverseBytes(0, 4);
- data.ReverseBytes(4, 4);
-
// 39.3700787 = inches in a meter.
- metadata.HorizontalResolution = BitConverter.ToInt32(data, 0) / 39.3700787d;
- metadata.VerticalResolution = BitConverter.ToInt32(data, 4) / 39.3700787d;
+ metadata.HorizontalResolution = BinaryPrimitives.ReadInt32BigEndian(data.Slice(0, 4)) / 39.3700787d;
+ metadata.VerticalResolution = BinaryPrimitives.ReadInt32BigEndian(data.Slice(4, 4)) / 39.3700787d;
}
///
@@ -699,14 +697,14 @@ namespace SixLabors.ImageSharp.Formats.Png
/// The pixel format.
/// The de-filtered scanline
/// The image
- private void ProcessDefilteredScanline(byte[] defilteredScanline, ImageFrame pixels)
+ private void ProcessDefilteredScanline(Span defilteredScanline, ImageFrame pixels)
where TPixel : struct, IPixel
{
var color = default(TPixel);
Span rowSpan = pixels.GetPixelRowSpan(this.currentRow);
// Trim the first marker byte from the buffer
- var scanlineBuffer = new Span(defilteredScanline, 1, defilteredScanline.Length - 1);
+ Span scanlineBuffer = defilteredScanline.Slice(1, defilteredScanline.Length - 1);
switch (this.pngColorType)
{
@@ -1159,22 +1157,19 @@ namespace SixLabors.ImageSharp.Formats.Png
///
/// Reads a header chunk from the data.
///
- /// The containing data.
- private void ReadHeaderChunk(byte[] data)
+ /// The containing data.
+ private void ReadHeaderChunk(ReadOnlySpan data)
{
- this.header = new PngHeader();
-
- data.ReverseBytes(0, 4);
- data.ReverseBytes(4, 4);
-
- this.header.Width = BitConverter.ToInt32(data, 0);
- this.header.Height = BitConverter.ToInt32(data, 4);
-
- this.header.BitDepth = data[8];
- this.header.ColorType = (PngColorType)data[9];
- this.header.CompressionMethod = data[10];
- this.header.FilterMethod = data[11];
- this.header.InterlaceMethod = (PngInterlaceMode)data[12];
+ this.header = new PngHeader
+ {
+ Width = BinaryPrimitives.ReadInt32BigEndian(data.Slice(0, 4)),
+ Height = BinaryPrimitives.ReadInt32BigEndian(data.Slice(4, 4)),
+ BitDepth = data[8],
+ ColorType = (PngColorType)data[9],
+ CompressionMethod = data[10],
+ FilterMethod = data[11],
+ InterlaceMethod = (PngInterlaceMode)data[12]
+ };
}
///
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index 2735164996..7ae075569d 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
+using System.Buffers.Binary;
using System.IO;
using System.Linq;
using SixLabors.ImageSharp.Advanced;
@@ -243,20 +244,6 @@ namespace SixLabors.ImageSharp.Formats.Png
this.paeth?.Dispose();
}
- ///
- /// Writes an integer to the byte array.
- ///
- /// The containing image data.
- /// The amount to offset by.
- /// The value to write.
- private static void WriteInteger(byte[] data, int offset, int value)
- {
- byte[] buffer = BitConverter.GetBytes(value);
-
- buffer.ReverseBytes();
- Buffer.BlockCopy(buffer, 0, data, offset, 4);
- }
-
///
/// Writes an integer to the stream.
///
@@ -450,8 +437,8 @@ namespace SixLabors.ImageSharp.Formats.Png
/// The .
private void WriteHeaderChunk(Stream stream, PngHeader header)
{
- WriteInteger(this.chunkDataBuffer, 0, header.Width);
- WriteInteger(this.chunkDataBuffer, 4, header.Height);
+ BinaryPrimitives.WriteInt32BigEndian(new Span(this.chunkDataBuffer, 0, 4), header.Width);
+ BinaryPrimitives.WriteInt32BigEndian(new Span(this.chunkDataBuffer, 4, 4), header.Height);
this.chunkDataBuffer[8] = header.BitDepth;
this.chunkDataBuffer[9] = (byte)header.ColorType;
@@ -535,8 +522,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);
- WriteInteger(this.chunkDataBuffer, 0, dpmX);
- WriteInteger(this.chunkDataBuffer, 4, dpmY);
+ BinaryPrimitives.WriteInt32BigEndian(this.chunkDataBuffer.AsSpan().Slice(0, 4), dpmX);
+ BinaryPrimitives.WriteInt32BigEndian(this.chunkDataBuffer.AsSpan().Slice(4, 4), dpmY);
this.chunkDataBuffer[8] = 1;
diff --git a/src/ImageSharp/Memory/SpanHelper.cs b/src/ImageSharp/Memory/SpanHelper.cs
index 0c327484a0..3bad54a12b 100644
--- a/src/ImageSharp/Memory/SpanHelper.cs
+++ b/src/ImageSharp/Memory/SpanHelper.cs
@@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Memory
/// The destination .
/// The number of elements to copy
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe void Copy(Span source, Span destination, int count)
+ public static unsafe void Copy(ReadOnlySpan source, Span destination, int count)
where T : struct
{
DebugGuard.MustBeLessThanOrEqualTo(count, source.Length, nameof(count));
@@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.Memory
/// The to copy elements from.
/// The destination .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void Copy(Span source, Span destination)
+ public static void Copy(ReadOnlySpan source, Span destination)
where T : struct
{
Copy(source, destination, Math.Min(source.Length, destination.Length));
diff --git a/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.cs b/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.cs
index 9505ee6cf7..904e27c7f2 100644
--- a/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.cs
+++ b/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The source of data.
/// The to the destination pixels.
/// The number of pixels to convert.
- internal virtual void PackFromRgba32(Span source, Span destPixels, int count)
+ internal virtual void PackFromRgba32(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -42,7 +42,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination pixels.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void PackFromRgba32Bytes(Span sourceBytes, Span destPixels, int count)
+ internal void PackFromRgba32Bytes(ReadOnlySpan sourceBytes, Span destPixels, int count)
{
this.PackFromRgba32(sourceBytes.NonPortableCast(), destPixels, count);
}
@@ -54,7 +54,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The span of source pixels
/// The destination span of data.
/// The number of pixels to convert.
- internal virtual void ToRgba32(Span sourcePixels, Span dest, int count)
+ internal virtual void ToRgba32(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination bytes.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void ToRgba32Bytes(Span sourceColors, Span destBytes, int count)
+ internal void ToRgba32Bytes(ReadOnlySpan sourceColors, Span destBytes, int count)
{
this.ToRgba32(sourceColors, destBytes.NonPortableCast(), count);
}
@@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The source of data.
/// The to the destination pixels.
/// The number of pixels to convert.
- internal virtual void PackFromBgra32(Span source, Span destPixels, int count)
+ internal virtual void PackFromBgra32(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -113,7 +113,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination pixels.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void PackFromBgra32Bytes(Span sourceBytes, Span destPixels, int count)
+ internal void PackFromBgra32Bytes(ReadOnlySpan sourceBytes, Span destPixels, int count)
{
this.PackFromBgra32(sourceBytes.NonPortableCast(), destPixels, count);
}
@@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The span of source pixels
/// The destination span of data.
/// The number of pixels to convert.
- internal virtual void ToBgra32(Span sourcePixels, Span dest, int count)
+ internal virtual void ToBgra32(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -148,7 +148,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination bytes.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void ToBgra32Bytes(Span sourceColors, Span destBytes, int count)
+ internal void ToBgra32Bytes(ReadOnlySpan sourceColors, Span destBytes, int count)
{
this.ToBgra32(sourceColors, destBytes.NonPortableCast(), count);
}
@@ -159,7 +159,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The source of data.
/// The to the destination pixels.
/// The number of pixels to convert.
- internal virtual void PackFromRgb24(Span source, Span destPixels, int count)
+ internal virtual void PackFromRgb24(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -184,7 +184,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination pixels.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void PackFromRgb24Bytes(Span sourceBytes, Span destPixels, int count)
+ internal void PackFromRgb24Bytes(ReadOnlySpan sourceBytes, Span destPixels, int count)
{
this.PackFromRgb24(sourceBytes.NonPortableCast(), destPixels, count);
}
@@ -196,7 +196,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The span of source pixels
/// The destination span of data.
/// The number of pixels to convert.
- internal virtual void ToRgb24(Span sourcePixels, Span dest, int count)
+ internal virtual void ToRgb24(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -219,7 +219,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination bytes.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void ToRgb24Bytes(Span sourceColors, Span destBytes, int count)
+ internal void ToRgb24Bytes(ReadOnlySpan sourceColors, Span destBytes, int count)
{
this.ToRgb24(sourceColors, destBytes.NonPortableCast(), count);
}
@@ -230,7 +230,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The source of data.
/// The to the destination pixels.
/// The number of pixels to convert.
- internal virtual void PackFromBgr24(Span source, Span destPixels, int count)
+ internal virtual void PackFromBgr24(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -255,7 +255,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination pixels.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void PackFromBgr24Bytes(Span sourceBytes, Span destPixels, int count)
+ internal void PackFromBgr24Bytes(ReadOnlySpan sourceBytes, Span destPixels, int count)
{
this.PackFromBgr24(sourceBytes.NonPortableCast(), destPixels, count);
}
@@ -267,7 +267,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The span of source pixels
/// The destination span of data.
/// The number of pixels to convert.
- internal virtual void ToBgr24(Span sourcePixels, Span dest, int count)
+ internal virtual void ToBgr24(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -290,7 +290,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the destination bytes.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void ToBgr24Bytes(Span sourceColors, Span destBytes, int count)
+ internal void ToBgr24Bytes(ReadOnlySpan sourceColors, Span destBytes, int count)
{
this.ToBgr24(sourceColors, destBytes.NonPortableCast(), count);
}
diff --git a/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.tt b/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.tt
index 365f5cb514..999fe66107 100644
--- a/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.tt
+++ b/src/ImageSharp/PixelFormats/Generated/PixelOperations{TPixel}.Generated.tt
@@ -21,7 +21,7 @@
/// The span of source pixels
/// The destination span of data.
/// The number of pixels to convert.
- internal virtual void To<#=pixelType#>(Span sourcePixels, Span<<#=pixelType#>> dest, int count)
+ internal virtual void To<#=pixelType#>(ReadOnlySpan sourcePixels, Span<<#=pixelType#>> dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -44,7 +44,7 @@
/// The to the destination bytes.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void To<#=pixelType#>Bytes(Span sourceColors, Span destBytes, int count)
+ internal void To<#=pixelType#>Bytes(ReadOnlySpan sourceColors, Span destBytes, int count)
{
this.To<#=pixelType#>(sourceColors, destBytes.NonPortableCast>(), count);
}
@@ -61,7 +61,7 @@
/// The source of data.
/// The to the destination pixels.
/// The number of pixels to convert.
- internal virtual void PackFrom<#=pixelType#>(Span<<#=pixelType#>> source, Span destPixels, int count)
+ internal virtual void PackFrom<#=pixelType#>(ReadOnlySpan<<#=pixelType#>> source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -86,7 +86,7 @@
/// The to the destination pixels.
/// The number of pixels to convert.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void PackFrom<#=pixelType#>Bytes(Span sourceBytes, Span destPixels, int count)
+ internal void PackFrom<#=pixelType#>Bytes(ReadOnlySpan sourceBytes, Span destPixels, int count)
{
this.PackFrom<#=pixelType#>(sourceBytes.NonPortableCast>(), destPixels, count);
}
diff --git a/src/ImageSharp/PixelFormats/Generated/Rgba32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/Generated/Rgba32.PixelOperations.Generated.cs
index c5ee6661f7..a8e68e36db 100644
--- a/src/ImageSharp/PixelFormats/Generated/Rgba32.PixelOperations.Generated.cs
+++ b/src/ImageSharp/PixelFormats/Generated/Rgba32.PixelOperations.Generated.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.PixelFormats
{
///
- internal override void PackFromRgb24(Span source, Span destPixels, int count)
+ internal override void PackFromRgb24(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb24(Span sourcePixels, Span dest, int count)
+ internal override void ToRgb24(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void PackFromBgr24(Span source, Span destPixels, int count)
+ internal override void PackFromBgr24(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgr24(Span sourcePixels, Span dest, int count)
+ internal override void ToBgr24(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
@@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void PackFromBgra32(Span source, Span destPixels, int count)
+ internal override void PackFromBgra32(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgra32(Span sourcePixels, Span dest, int count)
+ internal override void ToBgra32(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs
index 6f79752406..e6238bf5a6 100644
--- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs
+++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs
@@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the source vectors.
/// The to the destination colors.
/// The number of pixels to convert.
- internal virtual void PackFromVector4(Span sourceVectors, Span destColors, int count)
+ internal virtual void PackFromVector4(ReadOnlySpan sourceVectors, Span destColors, int count)
{
GuardSpans(sourceVectors, nameof(sourceVectors), destColors, nameof(destColors), count);
@@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The to the source colors.
/// The to the destination vectors.
/// The number of pixels to convert.
- internal virtual void ToVector4(Span sourceColors, Span destVectors, int count)
+ internal virtual void ToVector4(ReadOnlySpan sourceColors, Span destVectors, int count)
{
GuardSpans(sourceColors, nameof(sourceColors), destVectors, nameof(destVectors), count);
@@ -75,14 +75,14 @@ namespace SixLabors.ImageSharp.PixelFormats
/// The destination parameter name
/// The minimum length
protected internal static void GuardSpans(
- Span source,
+ ReadOnlySpan source,
string sourceParamName,
Span dest,
string destParamName,
int minLength)
{
- Guard.MustBeSizedAtLeast(source, minLength, sourceParamName);
- Guard.MustBeSizedAtLeast(dest, minLength, destParamName);
+ Guard.MustBeSizedAtLeast(source, minLength, sourceParamName);
+ Guard.MustBeSizedAtLeast(dest, minLength, destParamName);
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/PixelFormats/Rgba32.PixelOperations.cs b/src/ImageSharp/PixelFormats/Rgba32.PixelOperations.cs
index d87820f847..a7e5736b0e 100644
--- a/src/ImageSharp/PixelFormats/Rgba32.PixelOperations.cs
+++ b/src/ImageSharp/PixelFormats/Rgba32.PixelOperations.cs
@@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// https://github.com/dotnet/corefx/issues/15957
///
///
- internal static void ToVector4SimdAligned(Span sourceColors, Span destVectors, int count)
+ internal static void ToVector4SimdAligned(ReadOnlySpan sourceColors, Span destVectors, int count)
{
if (!Vector.IsHardwareAccelerated)
{
@@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToVector4(Span sourceColors, Span destVectors, int count)
+ internal override void ToVector4(ReadOnlySpan sourceColors, Span destVectors, int count)
{
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors));
Guard.MustBeSizedAtLeast(destVectors, count, nameof(destVectors));
@@ -115,7 +115,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
- internal override void PackFromVector4(Span sourceVectors, Span destColors, int count)
+ internal override void PackFromVector4(ReadOnlySpan sourceVectors, Span destColors, int count)
{
GuardSpans(sourceVectors, nameof(sourceVectors), destColors, nameof(destColors), count);
@@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.PixelFormats
if (alignedCount > 0)
{
- Span flatSrc = sourceVectors.Slice(0, alignedCount).NonPortableCast();
+ ReadOnlySpan flatSrc = sourceVectors.Slice(0, alignedCount).NonPortableCast();
Span flatDest = destColors.NonPortableCast();
SimdUtils.BulkConvertNormalizedFloatToByteClampOverflows(flatSrc, flatDest);
@@ -145,7 +145,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void PackFromRgba32(Span source, Span destPixels, int count)
+ internal override void PackFromRgba32(ReadOnlySpan source, Span destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgba32(Span sourcePixels, Span dest, int count)
+ internal override void ToRgba32(ReadOnlySpan sourcePixels, Span dest, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), dest, nameof(dest), count);
diff --git a/src/ImageSharp/PixelFormats/RgbaVector.PixelOperations.cs b/src/ImageSharp/PixelFormats/RgbaVector.PixelOperations.cs
index 1886df29f1..f038eaa910 100644
--- a/src/ImageSharp/PixelFormats/RgbaVector.PixelOperations.cs
+++ b/src/ImageSharp/PixelFormats/RgbaVector.PixelOperations.cs
@@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.PixelFormats
internal class PixelOperations : PixelOperations
{
///
- internal override unsafe void ToVector4(Span sourceColors, Span destVectors, int count)
+ internal override unsafe void ToVector4(ReadOnlySpan sourceColors, Span destVectors, int count)
{
GuardSpans(sourceColors, nameof(sourceColors), destVectors, nameof(destVectors), count);