Changed Data-Spans in texture to be readonly

This commit is contained in:
DarthAffe committed 2021-02-23 23:01:04 +01:00
1 parent c9634f3913
commit b857fb2c81
3 files changed
+6 -6

No files matched your search

@@ -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);
}
+2 -2
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);
}
@@ -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);
}