os: Add Rect::contains() to geometry utils

This commit is contained in:
Norman Feske 2014-04-26 00:06:11 +02:00
parent 3e4eb0d135
commit fb673fe4fd
1 changed files with 6 additions and 0 deletions

View File

@ -135,6 +135,12 @@ class Genode::Rect
*/
bool fits(Area<DT> area) const { return w() >= area.w() && h() >= area.h(); }
/**
* Return true if the specified point lies within the rectangle
*/
bool contains(Point<CT> p) const {
return p.x() >= x1() && p.x() <= x2() && p.y() >= y1() && p.y() <= y2(); }
/**
* Create new rectangle by intersecting two rectangles
*/