From 2fd1aa12cb05b7bd41c180ad089a655f4bfc29af Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Sun, 29 Nov 2020 16:27:11 +0100 Subject: [PATCH] Another attempt using Slice for the destination in PixelOperations convert From and To --- .../Argb32.PixelOperations.Generated.cs | 22 ++++--------------- .../Bgr24.PixelOperations.Generated.cs | 22 ++++--------------- .../Bgra32.PixelOperations.Generated.cs | 22 ++++--------------- .../Bgra5551.PixelOperations.Generated.cs | 21 ++++-------------- .../L16.PixelOperations.Generated.cs | 21 ++++-------------- .../Generated/L8.PixelOperations.Generated.cs | 21 ++++-------------- .../La16.PixelOperations.Generated.cs | 21 ++++-------------- .../La32.PixelOperations.Generated.cs | 21 ++++-------------- .../Rgb24.PixelOperations.Generated.cs | 22 ++++--------------- .../Rgb48.PixelOperations.Generated.cs | 21 ++++-------------- .../Rgba32.PixelOperations.Generated.cs | 21 ++++-------------- .../Rgba64.PixelOperations.Generated.cs | 21 ++++-------------- .../Generated/_Common.ttinclude | 6 ++--- 13 files changed, 51 insertions(+), 211 deletions(-) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs index 9df708d44..cedd1762d 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromArgb32(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void FromVector4Destructive( Configuration configuration, @@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats { Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale)); } - /// public override void ToRgba32( Configuration configuration, @@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgba32.ToArgb32(source, dest); } - /// public override void ToBgra32( Configuration configuration, @@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgra32.ToArgb32(source, dest); } - /// public override void ToRgb24( Configuration configuration, @@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgb24.ToArgb32(source, dest); } - /// public override void ToBgr24( Configuration configuration, @@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgr24.ToArgb32(source, dest); } - /// public override void ToL8( Configuration configuration, @@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToL16( Configuration configuration, @@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromArgb32(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToArgb32(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToArgb32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs index a66a6e12c..c98e35656 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromBgr24(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void FromVector4Destructive( Configuration configuration, @@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats { Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply)); } - /// public override void ToRgba32( Configuration configuration, @@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgba32.ToBgr24(source, dest); } - /// public override void ToArgb32( Configuration configuration, @@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromArgb32.ToBgr24(source, dest); } - /// public override void ToBgra32( Configuration configuration, @@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgra32.ToBgr24(source, dest); } - /// public override void ToRgb24( Configuration configuration, @@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgb24.ToBgr24(source, dest); } - /// public override void ToL8( Configuration configuration, @@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToL16( Configuration configuration, @@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgr24(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToBgr24(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToBgr24(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs index 77b665a4c..02bb67532 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromBgra32(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void FromVector4Destructive( Configuration configuration, @@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats { Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale)); } - /// public override void ToRgba32( Configuration configuration, @@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgba32.ToBgra32(source, dest); } - /// public override void ToArgb32( Configuration configuration, @@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromArgb32.ToBgra32(source, dest); } - /// public override void ToRgb24( Configuration configuration, @@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgb24.ToBgra32(source, dest); } - /// public override void ToBgr24( Configuration configuration, @@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgr24.ToBgra32(source, dest); } - /// public override void ToL8( Configuration configuration, @@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToL16( Configuration configuration, @@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra32(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToBgra32(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToBgra32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs index 1d13722e4..a02ffc3a4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromBgra5551(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToL16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromBgra5551(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToBgra5551(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToBgra5551(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs index 03b84be5d..954ef2d98 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromL16(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL16(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToL16(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToL16(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs index f52e77b1a..b3d809de5 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromL8(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToL16( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromL8(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToL8(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToL8(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs index e01399b8a..14618d026 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromLa16(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToL16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa16(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToLa16(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToLa16(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs index 0aa2afef5..9620a1df4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromLa32(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToL16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromLa32(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToLa32(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToLa32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs index a9303f9d8..2fe7f3c20 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromRgb24(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void FromVector4Destructive( Configuration configuration, @@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats { Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply)); } - /// public override void ToRgba32( Configuration configuration, @@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgba32.ToRgb24(source, dest); } - /// public override void ToArgb32( Configuration configuration, @@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromArgb32.ToRgb24(source, dest); } - /// public override void ToBgra32( Configuration configuration, @@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgra32.ToRgb24(source, dest); } - /// public override void ToBgr24( Configuration configuration, @@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgr24.ToRgb24(source, dest); } - /// public override void ToL8( Configuration configuration, @@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToL16( Configuration configuration, @@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb24(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToRgb24(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToRgb24(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs index 30328366d..031008fe1 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromRgb48(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToL16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgb48(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToRgb48(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToRgb48(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs index c23198e76..16f96d2da 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromRgba32(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -67,7 +65,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromArgb32.ToRgba32(source, dest); } - /// public override void ToBgra32( Configuration configuration, @@ -95,7 +92,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgra32.ToRgba32(source, dest); } - /// public override void ToRgb24( Configuration configuration, @@ -123,7 +119,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromRgb24.ToRgba32(source, dest); } - /// public override void ToBgr24( Configuration configuration, @@ -151,7 +146,6 @@ namespace SixLabors.ImageSharp.PixelFormats Span dest = MemoryMarshal.Cast(destinationPixels); PixelConverter.FromBgr24.ToRgba32(source, dest); } - /// public override void ToL8( Configuration configuration, @@ -172,7 +166,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToL16( Configuration configuration, @@ -193,7 +186,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -214,7 +206,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -235,7 +226,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -256,7 +246,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToRgba64( Configuration configuration, @@ -277,7 +266,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -298,14 +286,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba32(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToRgba32(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToRgba32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs index 129e9ff0b..1f1571e91 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs @@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats /// internal partial class PixelOperations : PixelOperations { - - /// + /// public override void FromRgba64(Configuration configuration, ReadOnlySpan source, Span destinationPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } - /// public override void ToArgb32( Configuration configuration, @@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToBgr24( Configuration configuration, @@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToBgra32( Configuration configuration, @@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToL8( Configuration configuration, @@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToL16( Configuration configuration, @@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToLa16( Configuration configuration, @@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToLa32( Configuration configuration, @@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToRgb24( Configuration configuration, @@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToRgba32( Configuration configuration, @@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToRgb48( Configuration configuration, @@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void ToBgra5551( Configuration configuration, @@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats dp.FromRgba64(sp); } } - /// public override void From( Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels) { - PixelOperations.Instance.ToRgba64(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToRgba64(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude index 7c2eccedc..784ecf6fb 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude @@ -57,7 +57,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils; ReadOnlySpan sourcePixels, Span<<#=pixelType#>> destinationPixels) { - PixelOperations.Instance.To<#=pixelType#>(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.To<#=pixelType#>(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length)); } <#+ @@ -72,7 +72,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils; Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels)); - source.CopyTo(destinationPixels); + source.CopyTo(destinationPixels.Slice(0, source.Length)); } /// @@ -81,7 +81,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils; Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels)); - sourcePixels.CopyTo(destinationPixels); + sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length)); } <#+ }