1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Simplified span-fixes in Samplers

This commit is contained in:
Darth Affe 2023-04-24 23:13:12 +02:00
parent 4a0ae1a185
commit 93cd8055a2
3 changed files with 3 additions and 6 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace RGB.NET.Core;
@ -41,7 +40,7 @@ public sealed class AverageColorSampler : ISampler<Color>
{
ReadOnlySpan<Color> data = info[y];
fixed (Color* colorPtr = &MemoryMarshal.GetReference(data))
fixed (Color* colorPtr = data)
{
Color* current = colorPtr;
for (int i = 0; i < chunks; i++)

View File

@ -1,6 +1,5 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
using RGB.NET.Core;
namespace RGB.NET.Presets.Textures.Sampler;
@ -42,7 +41,7 @@ public sealed class AverageByteSampler : ISampler<byte>
{
ReadOnlySpan<byte> data = info[y];
fixed (byte* colorPtr = &MemoryMarshal.GetReference(data))
fixed (byte* colorPtr = data)
{
byte* current = colorPtr;
for (int i = 0; i < chunks; i++)

View File

@ -1,6 +1,5 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
using RGB.NET.Core;
namespace RGB.NET.Presets.Textures.Sampler;
@ -33,7 +32,7 @@ public sealed class AverageFloatSampler : ISampler<float>
{
ReadOnlySpan<float> data = info[y];
fixed (float* colorPtr = &MemoryMarshal.GetReference(data))
fixed (float* colorPtr = data)
{
float* current = colorPtr;
for (int i = 0; i < chunks; i++)