| 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;
|
| }
|
|
|