Browse Source

Fixing StyleCop

qoi
LuisAlfredo92 3 years ago
parent
commit
f7b4f493f3
No known key found for this signature in database GPG Key ID: 13A8436905993B8F
  1. 9
      src/ImageSharp/Common/Helpers/Numerics.cs
  2. 1
      src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs
  3. 1
      src/ImageSharp/Formats/Qoi/QoiEncoder.cs
  4. 11
      src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs

9
src/ImageSharp/Common/Helpers/Numerics.cs

@ -77,25 +77,25 @@ internal static class Numerics
/// Calculates <paramref name="x"/> % 64
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Modulo64(int value) => value & 63;
public static int Modulo64(int x) => x & 63;
/// <summary>
/// Calculates <paramref name="x"/> % 64
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static nint Modulo64(nint value) => value & 63;
public static nint Modulo64(nint x) => x & 63;
/// <summary>
/// Calculates <paramref name="x"/> % 256
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Modulo256(int value) => value & 255;
public static int Modulo256(int x) => x & 255;
/// <summary>
/// Calculates <paramref name="x"/> % 256
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static nint Modulo256(nint value) => value & 255;
public static nint Modulo256(nint x) => x & 255;
/// <summary>
/// Fast (x mod m) calculator, with the restriction that
@ -1063,5 +1063,4 @@ internal static class Numerics
public static nuint Vector256Count<TVector>(int length)
where TVector : struct
=> (uint)length / (uint)Vector256<TVector>.Count;
}

1
src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs

@ -146,7 +146,6 @@ internal class QoiDecoderCore : IImageDecoderInternals
{
using IMemoryOwner<Rgba32> previouslySeenPixelsBuffer = this.memoryAllocator.Allocate<Rgba32>(64, AllocationOptions.Clean);
Span<Rgba32> 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

1
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;

11
src/ImageSharp/Formats/Qoi/QoiEncoderCore.cs

@ -14,12 +14,21 @@ namespace SixLabors.ImageSharp.Formats.Qoi;
/// </summary>
public class QoiEncoderCore : IImageEncoderInternals
{
/// <summary>
/// The encoder with options
/// </summary>
private readonly QoiEncoder encoder;
/// <summary>
/// Used the manage memory allocations.
/// </summary>
private readonly MemoryAllocator memoryAllocator;
/// <summary>
/// Initializes a new instance of the <see cref="QoiEncoderCore"/> class.
/// </summary>
/// <param name="encoder">The encoder with options.</param>
/// <param name="memoryAllocator">The <see cref="MemoryAllocator" /> to use for buffer allocations.</param>
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);
}

Loading…
Cancel
Save