diff --git a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs
index 62f0481d4..f44ec56f7 100644
--- a/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs
+++ b/src/ImageSharp/Drawing/Processors/FillShapeProcessor.cs
@@ -88,7 +88,7 @@ namespace ImageSharp.Drawing.Processors
int offsetY = y - polyStartY;
Vector2 currentPoint = default(Vector2);
- Vector2 currentPointOffset = default(Vector2);
+
for (int x = minX; x < maxX; x++)
{
int offsetX = x - startX;
diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs
index b1f0fb458..8b86e3bd5 100644
--- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs
+++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs
@@ -15,9 +15,17 @@ namespace ImageSharp.Formats
///
internal partial struct Block8x8F
{
+ ///
+ /// Vector count
+ ///
public const int VectorCount = 16;
+
+ ///
+ /// Scalar count
+ ///
public const int ScalarCount = VectorCount * 4;
+#pragma warning disable SA1600 // ElementsMustBeDocumented
public Vector4 V0L;
public Vector4 V0R;
@@ -41,6 +49,7 @@ namespace ImageSharp.Formats
public Vector4 V7L;
public Vector4 V7R;
+#pragma warning restore SA1600 // ElementsMustBeDocumented
#pragma warning disable SA1310 // FieldNamesMustNotContainUnderscore
private static readonly Vector4 C_1_175876 = new Vector4(1.175876f);
@@ -59,6 +68,11 @@ namespace ImageSharp.Formats
private static readonly Vector4 C_0_125 = new Vector4(0.1250f);
#pragma warning restore SA1310 // FieldNamesMustNotContainUnderscore
+ ///
+ /// Index into the block
+ ///
+ /// The index
+ /// The float value at the specified index
public unsafe float this[int idx]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -143,25 +157,29 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Multiply in place
+ ///
+ /// Scalar to multiply by
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void MultiplyAllInplace(Vector4 s)
+ public void MultiplyAllInplace(Vector4 scalar)
{
- this.V0L *= s;
- this.V0R *= s;
- this.V1L *= s;
- this.V1R *= s;
- this.V2L *= s;
- this.V2R *= s;
- this.V3L *= s;
- this.V3R *= s;
- this.V4L *= s;
- this.V4R *= s;
- this.V5L *= s;
- this.V5R *= s;
- this.V6L *= s;
- this.V6R *= s;
- this.V7L *= s;
- this.V7R *= s;
+ this.V0L *= scalar;
+ this.V0R *= scalar;
+ this.V1L *= scalar;
+ this.V1R *= scalar;
+ this.V2L *= scalar;
+ this.V2R *= scalar;
+ this.V3L *= scalar;
+ this.V3R *= scalar;
+ this.V4L *= scalar;
+ this.V4R *= scalar;
+ this.V5L *= scalar;
+ this.V5R *= scalar;
+ this.V6L *= scalar;
+ this.V6R *= scalar;
+ this.V7L *= scalar;
+ this.V7R *= scalar;
}
///
diff --git a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs b/src/ImageSharp/Formats/Jpg/Components/Bytes.cs
index f848439a0..127ba478b 100644
--- a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs
+++ b/src/ImageSharp/Formats/Jpg/Components/Bytes.cs
@@ -23,8 +23,14 @@ namespace ImageSharp.Formats
///
public byte[] Buffer;
+ ///
+ /// Start of bytes read
+ ///
public int I;
+ ///
+ /// End of bytes read
+ ///
public int J;
///
@@ -44,6 +50,9 @@ namespace ImageSharp.Formats
return new Bytes { Buffer = ArrayPool.Rent(4096) };
}
+ ///
+ /// Disposes of the underlying buffer
+ ///
public void Dispose()
{
if (this.Buffer != null)
diff --git a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs b/src/ImageSharp/Formats/Jpg/Components/Huffman.cs
index 74f77f303..c0d5a5caa 100644
--- a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs
+++ b/src/ImageSharp/Formats/Jpg/Components/Huffman.cs
@@ -53,6 +53,12 @@ namespace ImageSharp.Formats
private static readonly ArrayPool IntBuffer = ArrayPool.Create(JpegDecoderCore.MaxCodeLength, 50);
+ ///
+ /// Initializes the Huffman tree
+ ///
+ /// Lut size
+ /// Max N codes
+ /// Max code length
public void Init(int lutSize, int maxNCodes, int maxCodeLength)
{
this.Lut = UshortBuffer.Rent(1 << lutSize);
@@ -62,6 +68,9 @@ namespace ImageSharp.Formats
this.Indices = IntBuffer.Rent(maxCodeLength);
}
+ ///
+ /// Disposes the underlying buffers
+ ///
public void Dispose()
{
UshortBuffer.Return(this.Lut, true);
diff --git a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs b/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs
index 4b4899849..c43e73614 100644
--- a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs
+++ b/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs
@@ -5,7 +5,6 @@
namespace ImageSharp.Formats
{
- using System.Numerics;
using System.Runtime.CompilerServices;
///
@@ -18,24 +17,48 @@ namespace ImageSharp.Formats
///
internal struct MutableSpan
{
+ ///
+ /// Data
+ ///
public T[] Data;
+ ///
+ /// Offset
+ ///
public int Offset;
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The size of the span
+ /// The offset (defaults to 0)
public MutableSpan(int size, int offset = 0)
{
this.Data = new T[size];
this.Offset = offset;
}
+ ///
+ /// Initializes a new instance of the struct.
+ ///
+ /// The data
+ /// The offset (defaults to 0)
public MutableSpan(T[] data, int offset = 0)
{
this.Data = data;
this.Offset = offset;
}
+ ///
+ /// Gets the total count of data
+ ///
public int TotalCount => this.Data.Length - this.Offset;
+ ///
+ /// Index into the data
+ ///
+ /// The data
+ /// The value at the specified index
public T this[int idx]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -53,57 +76,25 @@ namespace ImageSharp.Formats
public static implicit operator MutableSpan(T[] data) => new MutableSpan(data, 0);
+ ///
+ /// Slice the data
+ ///
+ /// The offset
+ /// The new
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public MutableSpan Slice(int offset)
{
return new MutableSpan(this.Data, this.Offset + offset);
}
+ ///
+ /// Add to the offset
+ ///
+ /// The additional offset
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddOffset(int offset)
{
this.Offset += offset;
}
}
-
- internal static class MutableSpanExtensions
- {
- public static MutableSpan Slice(this T[] array, int offset) => new MutableSpan(array, offset);
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void SaveTo(this MutableSpan data, ref Vector4 v)
- {
- v.X = data[0];
- v.Y = data[1];
- v.Z = data[2];
- v.W = data[3];
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void SaveTo(this MutableSpan data, ref Vector4 v)
- {
- v.X = data[0];
- v.Y = data[1];
- v.Z = data[2];
- v.W = data[3];
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void LoadFrom(this MutableSpan data, ref Vector4 v)
- {
- data[0] = v.X;
- data[1] = v.Y;
- data[2] = v.Z;
- data[3] = v.W;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void LoadFrom(this MutableSpan data, ref Vector4 v)
- {
- data[0] = (int)v.X;
- data[1] = (int)v.Y;
- data[2] = (int)v.Z;
- data[3] = (int)v.W;
- }
- }
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs b/src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs
new file mode 100644
index 000000000..42edcd3c4
--- /dev/null
+++ b/src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs
@@ -0,0 +1,81 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp.Formats.Jpg.Components
+{
+ using System.Numerics;
+ using System.Runtime.CompilerServices;
+
+ ///
+ /// MutableSpan Extensions
+ ///
+ internal static class MutableSpanExtensions
+ {
+ ///
+ /// Slice
+ ///
+ /// The type of the data in the span
+ /// The data array
+ /// The offset
+ /// The new
+ public static MutableSpan Slice(this T[] array, int offset) => new MutableSpan(array, offset);
+
+ ///
+ /// Save to a Vector4
+ ///
+ /// The data
+ /// The vector to save to
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void SaveTo(this MutableSpan data, ref Vector4 v)
+ {
+ v.X = data[0];
+ v.Y = data[1];
+ v.Z = data[2];
+ v.W = data[3];
+ }
+
+ ///
+ /// Save to a Vector4
+ ///
+ /// The data
+ /// The vector to save to
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void SaveTo(this MutableSpan data, ref Vector4 v)
+ {
+ v.X = data[0];
+ v.Y = data[1];
+ v.Z = data[2];
+ v.W = data[3];
+ }
+
+ ///
+ /// Load from Vector4
+ ///
+ /// The data
+ /// The vector to load from
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void LoadFrom(this MutableSpan data, ref Vector4 v)
+ {
+ data[0] = v.X;
+ data[1] = v.Y;
+ data[2] = v.Z;
+ data[3] = v.W;
+ }
+
+ ///
+ /// Load from Vector4
+ ///
+ /// The data
+ /// The vector to load from
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void LoadFrom(this MutableSpan data, ref Vector4 v)
+ {
+ data[0] = (int)v.X;
+ data[1] = (int)v.Y;
+ data[2] = (int)v.Z;
+ data[3] = (int)v.W;
+ }
+ }
+}
diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
index d93a12464..1fe222530 100644
--- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
@@ -449,6 +449,9 @@ namespace ImageSharp.Formats
}
}
+ ///
+ /// Dispose
+ ///
public void Dispose()
{
for (int i = 0; i < this.huffmanTrees.Length; i++)