Skip to content
Phosphor
/
API Reference
Search
PlasmaZones
Libraries
Guides
Brand
Palette
About
GitHub
Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
GeometryHelpers.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 fuddlesworth
2
// SPDX-License-Identifier: LGPL-2.1-or-later
3
4
#pragma once
5
6
#include <QRect>
7
#include <QRectF>
8
9
#include <algorithm>
10
11
namespace
PhosphorCompositor
{
12
18
namespace
GeometryHelpers {
19
29
inline
QRect
snapToRect
(
const
QRectF& rf)
30
{
31
const
int
left = qRound(rf.x());
32
const
int
top = qRound(rf.y());
33
const
int
right = qRound(rf.x() + rf.width());
34
const
int
bottom = qRound(rf.y() + rf.height());
35
return
QRect(left, top, std::max(0, right - left), std::max(0, bottom - top));
36
}
37
38
}
// namespace GeometryHelpers
39
}
// namespace PhosphorCompositor
PhosphorCompositor::GeometryHelpers::snapToRect
QRect snapToRect(const QRectF &rf)
Convert QRectF to QRect with edge-consistent rounding.
Definition
GeometryHelpers.h:29
PhosphorCompositor
Definition
AutotileState.h:16
phosphor-compositor
include
PhosphorCompositor
GeometryHelpers.h
Generated by
1.9.8