mirror of https://github.com/SixLabors/ImageSharp
3 changed files with 51 additions and 55 deletions
@ -0,0 +1,36 @@ |
|||||
|
<#@ template debug="false" hostspecific="false" language="C#" #> |
||||
|
<#@ assembly name="System.Core" #> |
||||
|
<#@ import namespace="System.Linq" #> |
||||
|
<#@ import namespace="System.Text" #> |
||||
|
<#@ import namespace="System.Collections.Generic" #> |
||||
|
// Copyright (c) Six Labors and contributors. |
||||
|
// Licensed under the Apache License, Version 2.0. |
||||
|
// <auto-generated /> |
||||
|
|
||||
|
using System; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
<#+ |
||||
|
void GenerateDefaultConvertToMethod(string fromPixelType, string toPixelType) |
||||
|
{ |
||||
|
#> |
||||
|
|
||||
|
/// <inheritdoc /> |
||||
|
internal override void To<#=toPixelType#>(ReadOnlySpan<<#=fromPixelType#>> sourcePixels, Span<<#=toPixelType#>> destPixels, int count) |
||||
|
{ |
||||
|
GuardSpans(sourcePixels, nameof(sourcePixels), destPixels, nameof(destPixels), count); |
||||
|
|
||||
|
ref <#=fromPixelType#> sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref <#=toPixelType#> destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < count; i++) |
||||
|
{ |
||||
|
ref <#=fromPixelType#> sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref <#=toPixelType#> dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.From<#=fromPixelType#>(sp); |
||||
|
} |
||||
|
} |
||||
|
<#+ |
||||
|
} |
||||
|
#> |
||||
Loading…
Reference in new issue