mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Simplified span-fixes in Samplers
This commit is contained in:
parent
4a0ae1a185
commit
93cd8055a2
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace RGB.NET.Core;
|
namespace RGB.NET.Core;
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ public sealed class AverageColorSampler : ISampler<Color>
|
|||||||
{
|
{
|
||||||
ReadOnlySpan<Color> data = info[y];
|
ReadOnlySpan<Color> data = info[y];
|
||||||
|
|
||||||
fixed (Color* colorPtr = &MemoryMarshal.GetReference(data))
|
fixed (Color* colorPtr = data)
|
||||||
{
|
{
|
||||||
Color* current = colorPtr;
|
Color* current = colorPtr;
|
||||||
for (int i = 0; i < chunks; i++)
|
for (int i = 0; i < chunks; i++)
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
namespace RGB.NET.Presets.Textures.Sampler;
|
namespace RGB.NET.Presets.Textures.Sampler;
|
||||||
@ -42,7 +41,7 @@ public sealed class AverageByteSampler : ISampler<byte>
|
|||||||
{
|
{
|
||||||
ReadOnlySpan<byte> data = info[y];
|
ReadOnlySpan<byte> data = info[y];
|
||||||
|
|
||||||
fixed (byte* colorPtr = &MemoryMarshal.GetReference(data))
|
fixed (byte* colorPtr = data)
|
||||||
{
|
{
|
||||||
byte* current = colorPtr;
|
byte* current = colorPtr;
|
||||||
for (int i = 0; i < chunks; i++)
|
for (int i = 0; i < chunks; i++)
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
namespace RGB.NET.Presets.Textures.Sampler;
|
namespace RGB.NET.Presets.Textures.Sampler;
|
||||||
@ -33,7 +32,7 @@ public sealed class AverageFloatSampler : ISampler<float>
|
|||||||
{
|
{
|
||||||
ReadOnlySpan<float> data = info[y];
|
ReadOnlySpan<float> data = info[y];
|
||||||
|
|
||||||
fixed (float* colorPtr = &MemoryMarshal.GetReference(data))
|
fixed (float* colorPtr = data)
|
||||||
{
|
{
|
||||||
float* current = colorPtr;
|
float* current = colorPtr;
|
||||||
for (int i = 0; i < chunks; i++)
|
for (int i = 0; i < chunks; i++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user