diff options
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/Region.cpp | 9 | ||||
| -rw-r--r-- | src/helpers/Region.hpp | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/helpers/Region.cpp b/src/helpers/Region.cpp index e510e3d3..38a3760b 100644 --- a/src/helpers/Region.cpp +++ b/src/helpers/Region.cpp @@ -92,6 +92,15 @@ std::vector<pixman_box32_t> CRegion::getRects() const { return result; } +wlr_box CRegion::getExtents() { + pixman_box32_t* box = pixman_region32_extents(&m_rRegion); + return {box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1}; +} + +bool CRegion::containsPoint(const Vector2D& vec) { + return pixman_region32_contains_point(&m_rRegion, vec.x, vec.y, nullptr); +} + bool CRegion::empty() { return !pixman_region32_not_empty(&m_rRegion); } diff --git a/src/helpers/Region.hpp b/src/helpers/Region.hpp index 1ad3e57e..42458234 100644 --- a/src/helpers/Region.hpp +++ b/src/helpers/Region.hpp @@ -42,6 +42,8 @@ class CRegion { CRegion& intersect(double x, double y, double w, double h); CRegion& translate(const Vector2D& vec); CRegion& invert(pixman_box32_t* box); + wlr_box getExtents(); + bool containsPoint(const Vector2D& vec); bool empty(); std::vector<pixman_box32_t> getRects() const; @@ -52,4 +54,4 @@ class CRegion { private: pixman_region32_t m_rRegion; -};
\ No newline at end of file +}; |
