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

Removed allocation when applying decorators

This commit is contained in:
Darth Affe 2023-05-08 20:47:47 +02:00
parent 93cd8055a2
commit acddfed2b1

View File

@ -74,9 +74,13 @@ public abstract class AbstractBrush : AbstractDecoratable<IBrushDecorator>, IBru
if (Decorators.Count == 0) return;
lock (Decorators)
foreach (IBrushDecorator decorator in Decorators)
// ReSharper disable once ForCanBeConvertedToForeach - Sadly this does not get optimized reliably and causes allocations if foreached
for (int i = 0; i < Decorators.Count; i++)
{
IBrushDecorator decorator = Decorators[i];
if (decorator.IsEnabled)
decorator.ManipulateColor(rectangle, renderTarget, ref color);
}
}
/// <summary>