Browse Source

Fixed lambda capturing this

pull/1065/head
Sergio Pedri 6 years ago
parent
commit
0c0d2bba6d
  1. 6
      src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs

6
src/ImageSharp/Processing/Processors/Effects/PixelShaderProcessorBase.cs

@ -40,6 +40,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
{
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
int startX = interest.X;
Configuration configuration = this.Configuration;
PixelConversionModifiers modifiers = this.modifiers;
ParallelHelper.IterateRowsWithTempBuffer<Vector4>(
interest,
@ -51,12 +53,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Effects
Span<Vector4> vectorSpan = vectorBuffer.Span;
int length = vectorSpan.Length;
Span<TPixel> rowSpan = source.GetPixelRowSpan(y).Slice(startX, length);
PixelOperations<TPixel>.Instance.ToVector4(this.Configuration, rowSpan, vectorSpan, this.modifiers);
PixelOperations<TPixel>.Instance.ToVector4(configuration, rowSpan, vectorSpan, modifiers);
// Run the user defined pixel shader on the current row of pixels
this.ApplyPixelShader(vectorSpan, y, startX);
PixelOperations<TPixel>.Instance.FromVector4Destructive(this.Configuration, vectorSpan, rowSpan, this.modifiers);
PixelOperations<TPixel>.Instance.FromVector4Destructive(configuration, vectorSpan, rowSpan, modifiers);
}
});
}

Loading…
Cancel
Save