Skip to content

Commit

Permalink
Slice destination to (0, count)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpopow committed Nov 29, 2020
1 parent 38a0dd1 commit 3fba6f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public virtual void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromArgb32Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromArgb32(configuration, MemoryMarshal.Cast<byte, Argb32>(sourceBytes).Slice(0, count), destinationPixels);
this.FromArgb32(configuration, MemoryMarshal.Cast<byte, Argb32>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -79,7 +79,7 @@ public virtual void ToArgb32(Configuration configuration, ReadOnlySpan<TPixel> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToArgb32Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToArgb32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Argb32>(destBytes));
this.ToArgb32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Argb32>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -115,7 +115,7 @@ public virtual void FromBgr24(Configuration configuration, ReadOnlySpan<Bgr24> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromBgr24Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromBgr24(configuration, MemoryMarshal.Cast<byte, Bgr24>(sourceBytes).Slice(0, count), destinationPixels);
this.FromBgr24(configuration, MemoryMarshal.Cast<byte, Bgr24>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -151,7 +151,7 @@ public virtual void ToBgr24(Configuration configuration, ReadOnlySpan<TPixel> so
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToBgr24Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToBgr24(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgr24>(destBytes));
this.ToBgr24(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgr24>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -187,7 +187,7 @@ public virtual void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromBgra32Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromBgra32(configuration, MemoryMarshal.Cast<byte, Bgra32>(sourceBytes).Slice(0, count), destinationPixels);
this.FromBgra32(configuration, MemoryMarshal.Cast<byte, Bgra32>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -223,7 +223,7 @@ public virtual void ToBgra32(Configuration configuration, ReadOnlySpan<TPixel> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToBgra32Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToBgra32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgra32>(destBytes));
this.ToBgra32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgra32>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -259,7 +259,7 @@ public virtual void FromL8(Configuration configuration, ReadOnlySpan<L8> source,
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromL8Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromL8(configuration, MemoryMarshal.Cast<byte, L8>(sourceBytes).Slice(0, count), destinationPixels);
this.FromL8(configuration, MemoryMarshal.Cast<byte, L8>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -295,7 +295,7 @@ public virtual void ToL8(Configuration configuration, ReadOnlySpan<TPixel> sourc
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToL8Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToL8(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, L8>(destBytes));
this.ToL8(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, L8>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -331,7 +331,7 @@ public virtual void FromL16(Configuration configuration, ReadOnlySpan<L16> sourc
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromL16Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromL16(configuration, MemoryMarshal.Cast<byte, L16>(sourceBytes).Slice(0, count), destinationPixels);
this.FromL16(configuration, MemoryMarshal.Cast<byte, L16>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -367,7 +367,7 @@ public virtual void ToL16(Configuration configuration, ReadOnlySpan<TPixel> sour
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToL16Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToL16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, L16>(destBytes));
this.ToL16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, L16>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -403,7 +403,7 @@ public virtual void FromLa16(Configuration configuration, ReadOnlySpan<La16> sou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromLa16Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromLa16(configuration, MemoryMarshal.Cast<byte, La16>(sourceBytes).Slice(0, count), destinationPixels);
this.FromLa16(configuration, MemoryMarshal.Cast<byte, La16>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -439,7 +439,7 @@ public virtual void ToLa16(Configuration configuration, ReadOnlySpan<TPixel> sou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToLa16Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToLa16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, La16>(destBytes));
this.ToLa16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, La16>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -475,7 +475,7 @@ public virtual void FromLa32(Configuration configuration, ReadOnlySpan<La32> sou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromLa32Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromLa32(configuration, MemoryMarshal.Cast<byte, La32>(sourceBytes).Slice(0, count), destinationPixels);
this.FromLa32(configuration, MemoryMarshal.Cast<byte, La32>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -511,7 +511,7 @@ public virtual void ToLa32(Configuration configuration, ReadOnlySpan<TPixel> sou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToLa32Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToLa32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, La32>(destBytes));
this.ToLa32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, La32>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -547,7 +547,7 @@ public virtual void FromRgb24(Configuration configuration, ReadOnlySpan<Rgb24> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgb24Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromRgb24(configuration, MemoryMarshal.Cast<byte, Rgb24>(sourceBytes).Slice(0, count), destinationPixels);
this.FromRgb24(configuration, MemoryMarshal.Cast<byte, Rgb24>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -583,7 +583,7 @@ public virtual void ToRgb24(Configuration configuration, ReadOnlySpan<TPixel> so
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToRgb24Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToRgb24(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgb24>(destBytes));
this.ToRgb24(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgb24>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -619,7 +619,7 @@ public virtual void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgba32Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromRgba32(configuration, MemoryMarshal.Cast<byte, Rgba32>(sourceBytes).Slice(0, count), destinationPixels);
this.FromRgba32(configuration, MemoryMarshal.Cast<byte, Rgba32>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -655,7 +655,7 @@ public virtual void ToRgba32(Configuration configuration, ReadOnlySpan<TPixel> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToRgba32Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToRgba32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgba32>(destBytes));
this.ToRgba32(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgba32>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -691,7 +691,7 @@ public virtual void FromRgb48(Configuration configuration, ReadOnlySpan<Rgb48> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgb48Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromRgb48(configuration, MemoryMarshal.Cast<byte, Rgb48>(sourceBytes).Slice(0, count), destinationPixels);
this.FromRgb48(configuration, MemoryMarshal.Cast<byte, Rgb48>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -727,7 +727,7 @@ public virtual void ToRgb48(Configuration configuration, ReadOnlySpan<TPixel> so
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToRgb48Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToRgb48(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgb48>(destBytes));
this.ToRgb48(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgb48>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -763,7 +763,7 @@ public virtual void FromRgba64(Configuration configuration, ReadOnlySpan<Rgba64>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgba64Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromRgba64(configuration, MemoryMarshal.Cast<byte, Rgba64>(sourceBytes).Slice(0, count), destinationPixels);
this.FromRgba64(configuration, MemoryMarshal.Cast<byte, Rgba64>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -799,7 +799,7 @@ public virtual void ToRgba64(Configuration configuration, ReadOnlySpan<TPixel> s
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToRgba64Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToRgba64(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgba64>(destBytes));
this.ToRgba64(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Rgba64>(destBytes.Slice(0, count)));
}

/// <summary>
Expand Down Expand Up @@ -835,7 +835,7 @@ public virtual void FromBgra5551(Configuration configuration, ReadOnlySpan<Bgra5
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromBgra5551Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.FromBgra5551(configuration, MemoryMarshal.Cast<byte, Bgra5551>(sourceBytes).Slice(0, count), destinationPixels);
this.FromBgra5551(configuration, MemoryMarshal.Cast<byte, Bgra5551>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

/// <summary>
Expand Down Expand Up @@ -871,7 +871,7 @@ public virtual void ToBgra5551(Configuration configuration, ReadOnlySpan<TPixel>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ToBgra5551Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.ToBgra5551(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgra5551>(destBytes));
this.ToBgra5551(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, Bgra5551>(destBytes.Slice(0, count)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void From<#=pixelType#>Bytes(Configuration configuration, ReadOnlySpan<byte> sourceBytes, Span<TPixel> destinationPixels, int count)
{
this.From<#=pixelType#>(configuration, MemoryMarshal.Cast<byte, <#=pixelType#>>(sourceBytes).Slice(0, count), destinationPixels);
this.From<#=pixelType#>(configuration, MemoryMarshal.Cast<byte, <#=pixelType#>>(sourceBytes).Slice(0, count), destinationPixels.Slice(0, count));
}

<#
Expand Down Expand Up @@ -90,7 +90,7 @@
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void To<#=pixelType#>Bytes(Configuration configuration, ReadOnlySpan<TPixel> sourcePixels, Span<byte> destBytes, int count)
{
this.To<#=pixelType#>(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, <#=pixelType#>>(destBytes));
this.To<#=pixelType#>(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast<byte, <#=pixelType#>>(destBytes.Slice(0, count)));
}
<#
}
Expand Down

0 comments on commit 3fba6f8

Please sign in to comment.