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

Changed Data-Spans in texture to be readonly

This commit is contained in:
Darth Affe 2021-02-23 23:01:04 +01:00
parent c9634f3913
commit b857fb2c81
3 changed files with 6 additions and 6 deletions

View File

@ -119,10 +119,10 @@ namespace RGB.NET.Core
protected override void GetRegionData(int x, int y, int width, int height, in Span<Color> buffer)
{
Span<Color> data = Data.AsSpan();
ReadOnlySpan<Color> data = Data.AsSpan();
for (int i = 0; i < height; i++)
{
Span<Color> dataSlice = data.Slice(((y + i) * _stride) + x, width);
ReadOnlySpan<Color> dataSlice = data.Slice(((y + i) * _stride) + x, width);
Span<Color> destination = buffer.Slice(i * width, width);
dataSlice.CopyTo(destination);
}

View File

@ -58,10 +58,10 @@ namespace RGB.NET.Presets.Textures
protected override void GetRegionData(int x, int y, int width, int height, in Span<byte> buffer)
{
int width3 = width * 3;
Span<byte> data = Data.AsSpan();
ReadOnlySpan<byte> data = Data.AsSpan();
for (int i = 0; i < height; i++)
{
Span<byte> dataSlice = data.Slice((((y + i) * _stride) + x) * 3, width3);
ReadOnlySpan<byte> dataSlice = data.Slice((((y + i) * _stride) + x) * 3, width3);
Span<byte> destination = buffer.Slice(i * width3, width3);
dataSlice.CopyTo(destination);
}

View File

@ -58,10 +58,10 @@ namespace RGB.NET.Presets.Textures
protected override void GetRegionData(int x, int y, int width, int height, in Span<float> buffer)
{
int width3 = width * 3;
Span<float> data = Data.AsSpan();
ReadOnlySpan<float> data = Data.AsSpan();
for (int i = 0; i < height; i++)
{
Span<float> dataSlice = data.Slice((((y + i) * _stride) + x) * 3, width3);
ReadOnlySpan<float> dataSlice = data.Slice((((y + i) * _stride) + x) * 3, width3);
Span<float> destination = buffer.Slice(i * width3, width3);
dataSlice.CopyTo(destination);
}