summaryrefslogtreecommitdiffstats
path: root/base/gfx/rect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/gfx/rect.cc')
-rw-r--r--base/gfx/rect.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc
index 1e067e7..2a35575 100644
--- a/base/gfx/rect.cc
+++ b/base/gfx/rect.cc
@@ -225,6 +225,13 @@ Point Rect::CenterPoint() const {
return Point(x() + (width() + 1) / 2, y() + (height() + 1) / 2);
}
+bool Rect::SharesEdgeWith(const gfx::Rect& rect) const {
+ return (y() == rect.y() && height() == rect.height() &&
+ (x() == rect.right() || right() == rect.x())) ||
+ (x() == rect.x() && width() == rect.width() &&
+ (y() == rect.bottom() || bottom() == rect.y()));
+}
+
} // namespace gfx
std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) {