From a3f6a72a512d1c89788a9fd763baf071fde827c5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:27:28 +0200 Subject: [PATCH] region: allow ctor from pixman_box32_t --- src/helpers/Region.cpp | 4 ++++ src/helpers/Region.hpp | 2 ++ 2 files changed, 6 insertions(+) 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(&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&&);