diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs index 0c1572fe0f..aba3c0abdc 100644 --- a/src/ImageSharp/Common/Helpers/Numerics.cs +++ b/src/ImageSharp/Common/Helpers/Numerics.cs @@ -77,25 +77,25 @@ internal static class Numerics /// Calculates % 64 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int Modulo64(int value) => value & 63; + public static int Modulo64(int x) => x & 63; /// /// Calculates % 64 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static nint Modulo64(nint value) => value & 63; + public static nint Modulo64(nint x) => x & 63; /// /// Calculates % 256 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int Modulo256(int value) => value & 255; + public static int Modulo256(int x) => x & 255; /// /// Calculates % 256 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static nint Modulo256(nint value) => value & 255; + public static nint Modulo256(nint x) => x & 255; /// /// Fast (x mod m) calculator, with the restriction that @@ -1063,5 +1063,4 @@ internal static class Numerics public static nuint Vector256Count(int length) where TVector : struct => (uint)length / (uint)Vector256.Count; - } diff --git a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs index 564710f30b..bf4b0bf57c 100644 --- a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs +++ b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs @@ -146,7 +146,6 @@ internal class QoiDecoderCore : IImageDecoderInternals { using IMemoryOwner previouslySeenPixelsBuffer = this.memoryAllocator.Allocate(64, AllocationOptions.Clean); Span previouslySeenPixels = previouslySeenPixelsBuffer.GetSpan(); - //Rgba32[] previouslySeenPixels = new Rgba32[64]; Rgba32 previousPixel = new(0, 0, 0, 255); // We save the pixel to avoid loosing the fully opaque black pixel diff --git a/src/ImageSharp/Formats/Qoi/QoiEncoder.cs b/src/ImageSharp/Formats/Qoi/QoiEncoder.cs index 137cd8d706..85763a89e0 100644 --- a/src/ImageSharp/Formats/Qoi/QoiEncoder.cs +++ b/src/ImageSharp/Formats/Qoi/QoiEncoder.cs @@ -1,7 +1,6 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System.Text; using SixLabors.ImageSharp.Advanced; namespace SixLabors.ImageSharp.Formats.Qoi; diff --git a/src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs b/src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs index 3456be4f60..84c695edb7 100644 --- a/src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs +++ b/src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs @@ -14,12 +14,21 @@ namespace SixLabors.ImageSharp.Formats.Qoi; /// public class QoiEncoderCore : IImageEncoderInternals { + /// + /// The encoder with options + /// private readonly QoiEncoder encoder; + + /// + /// Used the manage memory allocations. + /// private readonly MemoryAllocator memoryAllocator; /// /// Initializes a new instance of the class. /// + /// The encoder with options. + /// The to use for buffer allocations. public QoiEncoderCore(QoiEncoder encoder, MemoryAllocator memoryAllocator) { this.encoder = encoder; @@ -101,10 +110,10 @@ public class QoiEncoderCore : IImageEncoderInternals { break; } + row = pixels.DangerousGetRowSpan(i); } - currentPixel = row[j]; currentPixel.ToRgba32(ref currentRgba32); }