mirror of
https://github.com/hyprwm/hyprutils.git
synced 2025-12-20 04:40:08 +01:00
math/region: reinit region for scale()
Apparently on some setups directly modifying the rectangles is a no-go, see #78. Pixman is another piece of undocumented shit. I hope whomever wrote this stubs their toe. Note to self: drop pixman, rewrite region. Fucking idiots.
This commit is contained in:
parent
feaaf44d59
commit
9ab64319e9
1 changed files with 11 additions and 6 deletions
|
|
@ -148,13 +148,18 @@ CRegion& Hyprutils::Math::CRegion::scale(const Vector2D& scale) {
|
|||
int rectsNum = 0;
|
||||
auto RECTSARR = pixman_region32_rectangles(&m_rRegion, &rectsNum);
|
||||
|
||||
std::vector<pixman_box32_t> boxes;
|
||||
boxes.resize(rectsNum);
|
||||
|
||||
for (int i = 0; i < rectsNum; ++i) {
|
||||
RECTSARR[i].x1 = std::floor(RECTSARR[i].x1 * scale.x);
|
||||
RECTSARR[i].x2 = std::ceil(RECTSARR[i].x2 * scale.x);
|
||||
RECTSARR[i].y1 = std::floor(RECTSARR[i].y1 * scale.y);
|
||||
RECTSARR[i].y2 = std::ceil(RECTSARR[i].y2 * scale.y);
|
||||
boxes[i].x1 = std::floor(RECTSARR[i].x1 * scale.x);
|
||||
boxes[i].x2 = std::ceil(RECTSARR[i].x2 * scale.x);
|
||||
boxes[i].y1 = std::floor(RECTSARR[i].y1 * scale.y);
|
||||
boxes[i].y2 = std::ceil(RECTSARR[i].y2 * scale.y);
|
||||
}
|
||||
|
||||
pixman_region32_fini(&m_rRegion);
|
||||
pixman_region32_init_rects(&m_rRegion, boxes.data(), boxes.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue