Commit 6d38adf2 authored by tebjan's avatar tebjan
Browse files

fixed 'none' errors for SvgUnits

parent 5dbfa773
...@@ -165,13 +165,7 @@ namespace Svg ...@@ -165,13 +165,7 @@ namespace Svg
} }
} }
/// <summary> #region Equals and GetHashCode implementation
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <param name="obj">Another object to compare to.</param>
/// <returns>
/// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
/// </returns>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj == null) return false; if (obj == null) return false;
...@@ -181,10 +175,33 @@ namespace Svg ...@@ -181,10 +175,33 @@ namespace Svg
return (unit.Value == this.Value && unit.Type == this.Type); return (unit.Value == this.Value && unit.Type == this.Type);
} }
public bool Equals(SvgUnit other)
{
return this._type == other._type && (this._value == other._value);
}
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); int hashCode = 0;
unchecked {
hashCode += 1000000007 * _type.GetHashCode();
hashCode += 1000000009 * _value.GetHashCode();
hashCode += 1000000021 * _isEmpty.GetHashCode();
hashCode += 1000000033 * _deviceValue.GetHashCode();
}
return hashCode;
}
public static bool operator ==(SvgUnit lhs, SvgUnit rhs)
{
return lhs.Equals(rhs);
}
public static bool operator !=(SvgUnit lhs, SvgUnit rhs)
{
return !(lhs == rhs);
} }
#endregion
public override string ToString() public override string ToString()
{ {
......
...@@ -49,6 +49,8 @@ namespace Svg ...@@ -49,6 +49,8 @@ namespace Svg
/// </summary> /// </summary>
public SvgUse() public SvgUse()
{ {
this.X = 0;
this.Y = 0;
} }
public override System.Drawing.Drawing2D.GraphicsPath Path public override System.Drawing.Drawing2D.GraphicsPath Path
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment