Seal PdfSubpath class and IPathCommand implementations, fix Close.GetHashCode() and fix #1027

This commit is contained in:
BobLd 2025-04-12 13:36:10 +01:00
parent 24902f1839
commit 580858348b

View File

@ -8,7 +8,7 @@
/// <summary> /// <summary>
/// A supbpath is made up of a sequence of connected segments. /// A supbpath is made up of a sequence of connected segments.
/// </summary> /// </summary>
public class PdfSubpath public sealed class PdfSubpath
{ {
private readonly List<IPathCommand> commands = new List<IPathCommand>(); private readonly List<IPathCommand> commands = new List<IPathCommand>();
@ -416,8 +416,10 @@
/// <summary> /// <summary>
/// Close the current <see cref="PdfSubpath"/>. /// Close the current <see cref="PdfSubpath"/>.
/// </summary> /// </summary>
public class Close : IPathCommand public sealed class Close : IPathCommand
{ {
private static readonly int _hash = typeof(Close).GetHashCode();
/// <inheritdoc /> /// <inheritdoc />
public PdfRectangle? GetBoundingRectangle() public PdfRectangle? GetBoundingRectangle()
{ {
@ -439,15 +441,14 @@
/// <inheritdoc /> /// <inheritdoc />
public override int GetHashCode() public override int GetHashCode()
{ {
// ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode return _hash;
return base.GetHashCode();
} }
} }
/// <summary> /// <summary>
/// Move drawing of the current <see cref="PdfSubpath"/> to the specified location. /// Move drawing of the current <see cref="PdfSubpath"/> to the specified location.
/// </summary> /// </summary>
public class Move : IPathCommand public sealed class Move : IPathCommand
{ {
/// <summary> /// <summary>
/// The location to move to. /// The location to move to.
@ -497,7 +498,7 @@
/// <summary> /// <summary>
/// Draw a straight line between two points. /// Draw a straight line between two points.
/// </summary> /// </summary>
public class Line : IPathCommand public sealed class Line : IPathCommand
{ {
/// <summary> /// <summary>
/// The start of the line. /// The start of the line.