summaryrefslogtreecommitdiff
path: root/src/point.cpp
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-01-22 00:16:27 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-01-22 00:16:27 +0800
commit6c76a7cf9455e535a815a74bbebe261c8b9785f0 (patch)
treed206b773445dabb578cdbedb0bce02c3948a04cb /src/point.cpp
parentc5e731bfd78ece8714470519a3bbb470f2d09001 (diff)
downloadunity-window-decorator-6c76a7cf9455e535a815a74bbebe261c8b9785f0.tar.gz
unity-window-decorator-6c76a7cf9455e535a815a74bbebe261c8b9785f0.tar.bz2
Add appropriate operator overloads to CompPoint
Diffstat (limited to 'src/point.cpp')
-rw-r--r--src/point.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/point.cpp b/src/point.cpp
index c77e6cf..9b1f93f 100644
--- a/src/point.cpp
+++ b/src/point.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright © 2008 Dennis Kasprzyk
+ * Copyright © 2008 Dennis Kasprzyk
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -67,3 +67,34 @@ CompPoint::operator!= (const CompPoint &point) const
{
return !(*this == point);
}
+
+CompPoint &
+CompPoint::operator+= (const CompPoint &point)
+{
+ mX += point.mX;
+ mY += point.mY;
+
+ return *this;
+}
+
+CompPoint
+CompPoint::operator+ (const CompPoint &rhs) const
+{
+ return CompPoint (mX + rhs.mX, mY + rhs.mY);
+}
+
+CompPoint &
+CompPoint::operator-= (const CompPoint &point)
+{
+ mX -= point.mX;
+ mY -= point.mY;
+
+ return *this;
+}
+
+CompPoint
+CompPoint::operator- (const CompPoint &rhs) const
+{
+ return CompPoint (mX - rhs.mX, mY - rhs.mY);
+}
+