From 260a820b80379f172fbaedf4d0d61a408da7ab0a Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Thu, 13 Apr 2023 02:03:13 +0200 Subject: [PATCH] Added SkipLocalsInitAttribute to Sample-Methods --- RGB.NET.Core/Rendering/Textures/PixelTexture.cs | 1 + RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs | 2 ++ RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs index 3672e2c..4ea5f06 100644 --- a/RGB.NET.Core/Rendering/Textures/PixelTexture.cs +++ b/RGB.NET.Core/Rendering/Textures/PixelTexture.cs @@ -76,6 +76,7 @@ public abstract class PixelTexture : ITexture /// The with of the region. /// The height of the region. /// The sampled color. + [SkipLocalsInit] public virtual Color this[int x, int y, int width, int height] { get diff --git a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs index 8d5b8b6..0486c5a 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageByteSampler.cs @@ -1,5 +1,6 @@ using System; using System.Numerics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using RGB.NET.Core; @@ -19,6 +20,7 @@ public class AverageByteSampler : ISampler #region Methods /// + [SkipLocalsInit] public unsafe void Sample(in SamplerInfo info, in Span pixelData) { int count = info.Width * info.Height; diff --git a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs index 50e9563..b047773 100644 --- a/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs +++ b/RGB.NET.Presets/Textures/Sampler/AverageFloatSampler.cs @@ -1,5 +1,6 @@ using System; using System.Numerics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using RGB.NET.Core; @@ -13,6 +14,7 @@ public class AverageFloatSampler : ISampler #region Methods /// + [SkipLocalsInit] public unsafe void Sample(in SamplerInfo info, in Span pixelData) { int count = info.Width * info.Height;