mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Changed Data-Spans in texture to be readonly
This commit is contained in:
parent
c9634f3913
commit
b857fb2c81
@ -119,10 +119,10 @@ namespace RGB.NET.Core
|
|||||||
|
|
||||||
protected override void GetRegionData(int x, int y, int width, int height, in Span<Color> buffer)
|
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++)
|
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);
|
Span<Color> destination = buffer.Slice(i * width, width);
|
||||||
dataSlice.CopyTo(destination);
|
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<byte> buffer)
|
protected override void GetRegionData(int x, int y, int width, int height, in Span<byte> buffer)
|
||||||
{
|
{
|
||||||
int width3 = width * 3;
|
int width3 = width * 3;
|
||||||
Span<byte> data = Data.AsSpan();
|
ReadOnlySpan<byte> data = Data.AsSpan();
|
||||||
for (int i = 0; i < height; i++)
|
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);
|
Span<byte> destination = buffer.Slice(i * width3, width3);
|
||||||
dataSlice.CopyTo(destination);
|
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)
|
protected override void GetRegionData(int x, int y, int width, int height, in Span<float> buffer)
|
||||||
{
|
{
|
||||||
int width3 = width * 3;
|
int width3 = width * 3;
|
||||||
Span<float> data = Data.AsSpan();
|
ReadOnlySpan<float> data = Data.AsSpan();
|
||||||
for (int i = 0; i < height; i++)
|
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);
|
Span<float> destination = buffer.Slice(i * width3, width3);
|
||||||
dataSlice.CopyTo(destination);
|
dataSlice.CopyTo(destination);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user