Loading include/ui/Region.h +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public: inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; } inline Rect bounds() const { return getBounds(); } bool contains(const Point& point) const; bool contains(int x, int y) const; // the region becomes its bounds Region& makeBoundsSelf(); Loading libs/ui/Region.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,22 @@ Region& Region::makeBoundsSelf() return *this; } bool Region::contains(const Point& point) const { return contains(point.x, point.y); } bool Region::contains(int x, int y) const { const_iterator cur = begin(); const_iterator const tail = end(); while (cur != tail) { if (y >= cur->top && y < cur->bottom && x >= cur->left && x < cur->right) { return true; } cur++; } return false; } void Region::clear() { mStorage.clear(); Loading Loading
include/ui/Region.h +3 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,9 @@ public: inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; } inline Rect bounds() const { return getBounds(); } bool contains(const Point& point) const; bool contains(int x, int y) const; // the region becomes its bounds Region& makeBoundsSelf(); Loading
libs/ui/Region.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,22 @@ Region& Region::makeBoundsSelf() return *this; } bool Region::contains(const Point& point) const { return contains(point.x, point.y); } bool Region::contains(int x, int y) const { const_iterator cur = begin(); const_iterator const tail = end(); while (cur != tail) { if (y >= cur->top && y < cur->bottom && x >= cur->left && x < cur->right) { return true; } cur++; } return false; } void Region::clear() { mStorage.clear(); Loading