From 1e87e4e8fa58b045701ecaa2cc7cf893ffda5804 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 3 Feb 2026 18:05:42 +1000 Subject: [PATCH] Implement CodeQL feedback --- .../Processors/Transforms/Resize/ResizeKernelMap.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs index e5ac3381b..0b8106e0b 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs @@ -51,15 +51,8 @@ internal partial class ResizeKernelMap : IDisposable this.DestinationLength = destinationLength; this.MaxDiameter = (radius * 2) + 1; - if (ResizeKernel.IsHardwareAccelerated) - { - this.data = memoryAllocator.Allocate2D(this.MaxDiameter * 4, bufferHeight, preferContiguosImageBuffers: true); - } - else - { - this.data = memoryAllocator.Allocate2D(this.MaxDiameter, bufferHeight, preferContiguosImageBuffers: true); - } - + int diameter = ResizeKernel.IsHardwareAccelerated ? this.MaxDiameter * 4 : this.MaxDiameter; + this.data = memoryAllocator.Allocate2D(diameter, bufferHeight, preferContiguosImageBuffers: true); this.pinHandle = this.data.DangerousGetSingleMemory().Pin(); this.kernels = new ResizeKernel[destinationLength]; this.tempValues = new float[this.MaxDiameter];