aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-07-20 18:27:28 +0200
committervaxerski <[email protected]>2023-07-20 18:27:28 +0200
commita3f6a72a512d1c89788a9fd763baf071fde827c5 (patch)
tree6b276c9df8edce20979e6ed858cf5049a19ab3fd
parentd2a8b8c2de91b748f0c03ef36ecc3e2b7e4fceab (diff)
downloadHyprland-a3f6a72a512d1c89788a9fd763baf071fde827c5.tar.gz
Hyprland-a3f6a72a512d1c89788a9fd763baf071fde827c5.zip
region: allow ctor from pixman_box32_t
-rw-r--r--src/helpers/Region.cpp4
-rw-r--r--src/helpers/Region.hpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/helpers/Region.cpp b/src/helpers/Region.cpp
index 3a210d06..e510e3d3 100644
--- a/src/helpers/Region.cpp
+++ b/src/helpers/Region.cpp
@@ -18,6 +18,10 @@ CRegion::CRegion(wlr_box* box) {
pixman_region32_init_rect(&m_rRegion, box->x, box->y, box->width, box->height);
}
+CRegion::CRegion(pixman_box32_t* box) {
+ pixman_region32_init_rect(&m_rRegion, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1);
+}
+
CRegion::CRegion(const CRegion& other) {
pixman_region32_init(&m_rRegion);
pixman_region32_copy(&m_rRegion, const_cast<CRegion*>(&other)->pixman());
diff --git a/src/helpers/Region.hpp b/src/helpers/Region.hpp
index 5c700fa5..1ad3e57e 100644
--- a/src/helpers/Region.hpp
+++ b/src/helpers/Region.hpp
@@ -15,6 +15,8 @@ class CRegion {
CRegion(double x, double y, double w, double h);
/* Create from a wlr_box */
CRegion(wlr_box* box);
+ /* Create from a pixman_box32_t */
+ CRegion(pixman_box32_t* box);
CRegion(const CRegion&);
CRegion(CRegion&&);