Browse Source

Implement CodeQL feedback

pull/2793/head
James Jackson-South 4 days ago
parent
commit
1e87e4e8fa
  1. 11
      src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs

11
src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs

@ -51,15 +51,8 @@ internal partial class ResizeKernelMap : IDisposable
this.DestinationLength = destinationLength; this.DestinationLength = destinationLength;
this.MaxDiameter = (radius * 2) + 1; this.MaxDiameter = (radius * 2) + 1;
if (ResizeKernel.IsHardwareAccelerated) int diameter = ResizeKernel.IsHardwareAccelerated ? this.MaxDiameter * 4 : this.MaxDiameter;
{ this.data = memoryAllocator.Allocate2D<float>(diameter, bufferHeight, preferContiguosImageBuffers: true);
this.data = memoryAllocator.Allocate2D<float>(this.MaxDiameter * 4, bufferHeight, preferContiguosImageBuffers: true);
}
else
{
this.data = memoryAllocator.Allocate2D<float>(this.MaxDiameter, bufferHeight, preferContiguosImageBuffers: true);
}
this.pinHandle = this.data.DangerousGetSingleMemory().Pin(); this.pinHandle = this.data.DangerousGetSingleMemory().Pin();
this.kernels = new ResizeKernel[destinationLength]; this.kernels = new ResizeKernel[destinationLength];
this.tempValues = new float[this.MaxDiameter]; this.tempValues = new float[this.MaxDiameter];

Loading…
Cancel
Save