diff --git a/Source/OpenTK/Graphics/ColorFormat.cs b/Source/OpenTK/Graphics/ColorFormat.cs
index b046f20e..12d7aafb 100644
--- a/Source/OpenTK/Graphics/ColorFormat.cs
+++ b/Source/OpenTK/Graphics/ColorFormat.cs
@@ -36,7 +36,7 @@ namespace OpenTK.Graphics
/// A ColorFormat contains Red, Green, Blue and Alpha components that descibe
/// the allocated bits per pixel for the corresponding color.
///
- public struct ColorFormat : IComparable
+ public struct ColorFormat : IComparable, IEquatable
{
byte red, green, blue, alpha;
bool isIndexed;
@@ -181,6 +181,19 @@ namespace OpenTK.Graphics
#endregion
+ #region IEquatable Members
+
+ public bool Equals(ColorFormat other)
+ {
+ return
+ Red == other.Red &&
+ Green == other.Green &&
+ Blue == other.Blue &&
+ Alpha == other.Alpha;
+ }
+
+ #endregion
+
#region Overrides
///
@@ -190,7 +203,7 @@ namespace OpenTK.Graphics
/// True if this instance is equal to obj; false otherwise.
public override bool Equals(object obj)
{
- return (obj is ColorFormat) ? (this == (ColorFormat)obj) : false;
+ return (obj is ColorFormat) ? this.Equals((ColorFormat)obj) : false;
}
///
@@ -201,17 +214,7 @@ namespace OpenTK.Graphics
/// True if both instances are equal; false otherwise.
public static bool operator ==(ColorFormat left, ColorFormat right)
{
- if ((object)left == (object)null && (object)right != (object)null ||
- (object)left != (object)null && (object)right == (object)null)
- return false;
-
- if ((object)left == (object)null && (object)right == (object)null)
- return true;
-
- return left.Red == right.Red &&
- left.Green == right.Green &&
- left.Blue == right.Blue &&
- left.Alpha == right.Alpha;
+ return left.Equals(right);
}
///