mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
Fixed potential performance issue with for-loops when Spans are passed by reference
This commit is contained in:
1 parent
5f71ffdf1f
commit
f21acbd767
36 files changed
+40
-40
No files matched your search
@@ -61,7 +61,7 @@ public sealed class BytePixelTexture : PixelTexture<byte>
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected override Color GetColor(in ReadOnlySpan<byte> pixel)
|
||||
protected override Color GetColor(ReadOnlySpan<byte> pixel)
|
||||
{
|
||||
return ColorFormat switch
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed class FloatPixelTexture : PixelTexture<float>
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected override Color GetColor(in ReadOnlySpan<float> pixel)
|
||||
protected override Color GetColor(ReadOnlySpan<float> pixel)
|
||||
{
|
||||
return ColorFormat switch
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed class AverageByteSampler : ISampler<byte>
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public unsafe void Sample(in SamplerInfo<byte> info, in Span<byte> pixelData)
|
||||
public unsafe void Sample(in SamplerInfo<byte> info, Span<byte> pixelData)
|
||||
{
|
||||
int count = info.Width * info.Height;
|
||||
if (count == 0) return;
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class AverageFloatSampler : ISampler<float>
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public unsafe void Sample(in SamplerInfo<float> info, in Span<float> pixelData)
|
||||
public unsafe void Sample(in SamplerInfo<float> info, Span<float> pixelData)
|
||||
{
|
||||
int count = info.Width * info.Height;
|
||||
if (count == 0) return;
|
||||
|
||||
Reference in new issue
Block a user