Browse Source

GenerateDefaultSelfConversionMethods

af/merge-core
Anton Firszov 8 years ago
parent
commit
663a10c4fb
  1. 5
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs
  2. 17
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.tt
  3. 23
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/RgbaCompatible.Common.ttinclude

5
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs

@ -19,7 +19,8 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal class PixelOperations : PixelOperations<Argb32>
{
/// <inheritdoc />
/// <inheritdoc />
internal override void FromArgb32(ReadOnlySpan<Argb32> source, Span<Argb32> destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
@ -35,7 +36,7 @@ namespace SixLabors.ImageSharp.PixelFormats
sourcePixels.Slice(0, count).CopyTo(destPixels);
}
/// <inheritdoc />
internal override void ToBgr24(ReadOnlySpan<Argb32> sourcePixels, Span<Bgr24> destPixels, int count)
{

17
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.tt

@ -13,23 +13,8 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal class PixelOperations : PixelOperations<Argb32>
{
/// <inheritdoc />
internal override void FromArgb32(ReadOnlySpan<Argb32> source, Span<Argb32> destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
source.Slice(0, count).CopyTo(destPixels);
}
/// <inheritdoc />
internal override void ToArgb32(ReadOnlySpan<Argb32> sourcePixels, Span<Argb32> destPixels, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), destPixels, nameof(destPixels), count);
sourcePixels.Slice(0, count).CopyTo(destPixels);
}
<#
GenerateDefaultSelfConversionMethods("Argb32");
GenerateDefaultConvertToMethod("Argb32", "Bgr24");
GenerateDefaultConvertToMethod("Argb32", "Bgra32");
GenerateDefaultConvertToMethod("Argb32", "Gray8");

23
src/ImageSharp/PixelFormats/PixelImplementations/Generated/RgbaCompatible.Common.ttinclude

@ -11,6 +11,29 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
<#+
void GenerateDefaultSelfConversionMethods(string pixelType)
{
#>
/// <inheritdoc />
internal override void From<#=pixelType#>(ReadOnlySpan<<#=pixelType#>> source, Span<<#=pixelType#>> destPixels, int count)
{
GuardSpans(source, nameof(source), destPixels, nameof(destPixels), count);
source.Slice(0, count).CopyTo(destPixels);
}
/// <inheritdoc />
internal override void To<#=pixelType#>(ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<<#=pixelType#>> destPixels, int count)
{
GuardSpans(sourcePixels, nameof(sourcePixels), destPixels, nameof(destPixels), count);
sourcePixels.Slice(0, count).CopyTo(destPixels);
}
<#+
}
void GenerateDefaultConvertToMethod(string fromPixelType, string toPixelType)
{
#>

Loading…
Cancel
Save