Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: geometry.h

Issue 6902072: wm: Update a lot of code to use structs from geometry.h. (Closed) Base URL: ssh://gitrw.chromium.org:9222/window_manager.git@master
Patch Set: move override-redirect stacking and visibility into Window Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « event_consumer.h ('k') | layout/layout_manager.h » ('j') | window.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: geometry.h
diff --git a/geometry.h b/geometry.h
index d214ce79a951065512449b8209b8dcbb3d934302..9091e8b614a263aee64c6084aa8d07e2ae763649 100644
--- a/geometry.h
+++ b/geometry.h
@@ -56,6 +56,9 @@ struct Size {
height = new_height;
}
+ bool empty() const { return width <= 0 || height <= 0; }
+ int area() const { return empty() ? 0 : width * height; }
+
bool operator==(const Size& o) const {
return width == o.width && height == o.height;
}
@@ -135,6 +138,13 @@ struct Rect {
height = std::max(0, max_y - y);
}
+ bool contains_point(const Point& point) const {
+ return point.x >= x &&
+ point.x < x + width &&
+ point.y >= y &&
+ point.y < y + height;
+ }
+
bool operator==(const Rect& o) const {
return x == o.x && y == o.y && width == o.width && height == o.height;
}
« no previous file with comments | « event_consumer.h ('k') | layout/layout_manager.h » ('j') | window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698